(function (w,d,dn,t){w[dn]=w[dn]||[];w[dn].push({eventType:'init',value:t,dc:''}); var f=d.getElementsByTagName('script')[0],c=d.createElement('script');c.async=true; c.src='https://tags.creativecdn.com/lIYwzfuK0XZ0bxING5Nd.js'; f.parentNode.insertBefore(c,f);})(window,document,'rtbhEvents','lIYwzfuK0XZ0bxING5Nd'); analytics.subscribe('product_added_to_cart', (event) => { var id = event.data.cartLine.merchandise.id; (rtbhEvents = window.rtbhEvents || []).push({ eventType: 'basketadd', offerId: id }); }); analytics.subscribe("checkout_started", (event) => { var uid = event.data.checkout.order?.customer?.id; if (uid === 'null') { uid = 'unknown'; } (rtbhEvents = window.rtbhEvents || []).push({ eventType: 'startorder' }, { eventType: 'uid', id: uid }); }); analytics.subscribe('checkout_completed', (event) => { var purchased_items = event.data.checkout.lineItems; var ids = []; for (i=0; i< purchased_items.length;i++){ ids.push(purchased_items[i].variant.id); } var uid = event.data.checkout.order?.customer?.id; if (uid === 'null') { uid = 'unknown'; } (rtbhEvents = window.rtbhEvents || []).push({ eventType: 'conversion', conversionClass: 'order', conversionSubClass: 'purchase', conversionId: event.data.checkout.order.id, conversionValue: event.data.checkout.totalPrice.amount, offerIds: ids }, { eventType: 'uid', id: uid }); });