*/
const voltageSearchScript = document.createElement('script');
voltageSearchScript.setAttribute('src', 'https://tracking.voltagesearch.com/vsm_js.js');
voltageSearchScript.setAttribute('type', 'text/javascript');
document.head.appendChild(voltageSearchScript);
/**/
const voltageSearchNoScript = document.createElement('noscript');
const voltageSearchNoscriptImg = document.createElement('img');
voltageSearchNoscriptImg.setAttribute('src', `https://tracking.voltagesearch.com/image.gif?aid=551&val=${event.data.checkout.totalPrice.amount}`);
voltageSearchNoscriptImg.setAttribute('border', '0');
voltageSearchNoscriptImg.setAttribute('width', '1');
voltageSearchNoscriptImg.setAttribute('height', '1');
voltageSearchNoScript.appendChild(voltageSearchNoscriptImg);
document.head.appendChild(voltageSearchNoScript);
/**/
/* Google Tag Manager (noscript) */
const GTMNoScript = document.createElement('noscript');
const GTMNoScriptIframe = document.createElement('img');
GTMNoScriptIframe.setAttribute('src', 'https://www.googletagmanager.com/ns.html?id=GTM-5NH4RCV');
GTMNoScriptIframe.setAttribute('height', '0');
GTMNoScriptIframe.setAttribute('width', '0');
GTMNoScriptIframe.setAttribute('style', 'display:none;visibility:hidden');
GTMNoScript.appendChild(GTMNoScriptIframe);
document.head.appendChild(voltageSearchNoScript);
/**/
/* End Google Tag Manager (noscript) */
/* Global site tag (gtag.js) - Google Analytics */
const gtag1Script = document.createElement('script');
gtag1Script.setAttribute('async', 'async');
gtag1Script.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=G-DKLNNGZ186');
document.head.appendChild(gtag1Script);
/**/
const gtag2Script = document.createElement('script');
gtag2Script.innerHTML = "window.dataLayer = window.dataLayer || [];\n" +
"function gtag(){window.dataLayer.push(arguments);}\n" +
"gtag('js', new Date());\n" +
"gtag('config', 'G-DKLNNGZ186');";
document.head.appendChild(gtag2Script);
/**/
const gtag3Script = document.createElement('script');
gtag3Script.innerHTML = `
const items = event.data.checkout.lineItems.map((lineItem, lineItemIndex) => {
let lineLevelTotalDiscount = 0;
lineItem.discountAllocations.map((discount, discountIndex) => {
lineLevelTotalDiscount = lineLevelTotalDiscount + discount.amount.amount;
});
if (lineLevelTotalDiscount > 0) {
lineLevelTotalDiscount = lineLevelTotalDiscount / 100;
}
return {
"item_id": \`${lineItem.variant.product.id}\`,
"item_name": \`${lineItem.title}\`,
"item_variant": \`${lineItem.variant.id}\`,
"quantity": \`${lineItem.quantity}\`,
"price": \`${lineItem.finalLinePrice.amount / 100}\`,
"affiliation": \`${lineItem.variant.product.vendor}\`,
"discount": \`${lineLevelTotalDiscount}\`
}
});
gtag('event', 'purchase', {
'send_to': 'G-DKLNNGZ186',
"transaction_id": \`${event.data.checkout.order.id}\`,
"affiliation": "Shopify Shopping Cart",
"email":\`${event.data.checkout.email}\`,
"value": \`${event.data.checkout.totalPrice.amount / 100}\`,
"currency": \`${event.data.checkout.totalPrice.currencyCode}\`,
"tax": \`${event.data.checkout.totalTax.amount / 100}\`,
"shipping": \`${event.data.checkout.shippingLine.price / 100}\`,
"items": items
});
`;
document.head.appendChild(gtag3Script);
/* Searchspring IntelliSuggest Tracking */
const searchspringScript = document.createElement('script');
searchspringScript.setAttribute('src', '//cdn.searchspring.net/intellisuggest/is.min.js');
searchspringScript.setAttribute('type', 'text/javascript');
document.head.appendChild(searchspringScript);
try {
IntelliSuggest.init({siteId:"mkqy9j"});
if(typeof __st == 'object' && typeof __st.cid == 'number') {
IntelliSuggest.setShopperId(__st.cid);
}
event.data.checkout.lineItems.forEach((lineItem) => {
IntelliSuggest.haveItem({sku: lineItem.variant.sku, qty: lineItem.quantity, price: lineItem.finalLinePrice.amount });
});
IntelliSuggest.inSale({orderId: event.data.checkout.order.id, total: event.data.checkout.totalPrice.amount});
} catch(err) {}
/* END Searchspring IntelliSuggest */
});
});})(self.webPixelsManager.createShopifyExtend('35160295', 'custom'));