Created
May 3, 2023 18:25
-
-
Save cinghaman/1ef5b548b9dd68637ff9cdfdbbf47275 to your computer and use it in GitHub Desktop.
checkout tracking scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!------------- SCRIPT ON THEME.LIQUID FILE ------> | |
<!-- microsoft --> | |
<script> | |
(function(w,d,t,r,u) | |
{ | |
var f,n,i; | |
w[u]=w[u]||[],f=function() | |
{ | |
var o={ti:"187033303"}; | |
o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad") | |
}, | |
n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function() | |
{ | |
var s=this.readyState; | |
s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null) | |
}, | |
i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i) | |
}) | |
(window,document,"script","//bat.bing.com/bat.js","uetq"); | |
</script> | |
<script> | |
window.uetq = window.uetq || []; | |
window.uetq.push('event', '', {'ecomm_prodid': '{{product.id}}', 'ecomm_pagetype': 'product'}); | |
</script> | |
<!------------------ ADDITIONAL SCRPTS ON CHECKOUT ---------------------> | |
<meta name="referrer" content="unsafe-url"> | |
<meta name="referrer" content="origin"> | |
<script type="text/javascript"> | |
var AddShoppersWidgetOptions = { 'loadCss': false }; | |
AddShoppersConversion = { | |
order_id: "{{ checkout.order_id}}", | |
value: "{{ checkout.total_price | money_without_currency }}", | |
email: "{{ checkout.order.email }}" | |
}; | |
(!function(){ | |
var t=document.createElement("script");t.type="text/javascript", | |
t.async=!0, | |
t.id="AddShoppers", | |
t.src="https://shop.pe/widget/widget_async.js#60b11a2ae694aa2ea7921ba5", | |
document.getElementsByTagName("head")[0].appendChild(t) | |
}()); | |
AddShoppersWidget.track_conv() | |
</script> | |
<script> | |
var enhanced_conversion_data = { | |
"first_name": "{{ checkout.billing_address.first_name }}", | |
"last_name": "{{ checkout.billing_address.last_name }}", | |
"home_address": { | |
"street": "{{ checkout.billing_address.street }}", | |
"city": "{{ checkout.billing_address.city }}", | |
"region": "{{ checkout.billing_address.province }}", | |
"postal_code": "{{ checkout.billing_address.zip }}", | |
"country": "{{ checkout.billing_address.country_code }}" | |
} | |
} | |
if("{{ checkout.email }}"){ | |
enhanced_conversion_data.email = "{{ checkout.email }}"; | |
} | |
if("{{ checkout.billing_address.phone }}"){ | |
enhanced_conversion_data.phone_number = "{{ checkout.billing_address.phone }}"; | |
} | |
</script> | |
<!-- Global site tag (gtag.js) - Google Ads: 724232935 --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-724232935"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'AW-724232935', {'allow_enhanced_conversions': true}); | |
</script> | |
{% if first_time_accessed %} | |
<script> | |
gtag('event', 'conversion', { | |
'send_to': 'AW-724232935/siUcCJaV1MkCEOfVq9kC', | |
'value': {{ checkout.total_price | divided_by: 100.0 }}, | |
'currency': '{{ currency }}', | |
'transaction_id': '{{ order_number }}', | |
}); | |
</script> | |
{% endif %} | |
<!-- Begin: Northbeam Shopify order status pixel --> | |
<script async type="text/javascript" src="//j.northbeam.io/ota-sp/e71457d2-6bf4-48e9-b4a4-c042dcfe098f.js"></script> | |
{% capture coupons %}{% for discount in discount_applications %}{{ discount.title }}{% unless forloop.last %}, {% endunless %}{% endfor %}{% endcapture %} | |
<script> | |
(function() { | |
var snowplow = window._nbq = window._nbq || function () { | |
window._nbq.q = window._nbq.q || []; | |
window._nbq.q.push(arguments); | |
}; | |
window._nbq.q = window._nbq.q || []; | |
{% unless first_time_accessed %}return;{% endunless %} | |
fireVersionEvent(); | |
fireConversionEvent(); | |
function fireVersionEvent() { | |
snowplow( | |
"trackStructEvent:nb", | |
"__nb_internal", | |
"shopify-conversion-tag-version", | |
"{{ order.order_number }}-{{id}}", | |
"f60d960168824c5bcd81843a1492826797bb8701"); | |
} | |
function fireConversionEvent() { | |
{% for line_item in line_items %} | |
var sku = { | |
product: "{{ line_item.product_id }}", | |
variant: "{{ line_item.variant_id }}", | |
}; | |
snowplow( | |
"addEnhancedEcommerceProductContext:nb", | |
JSON.stringify(sku, Object.keys(sku).sort()), | |
"{{ line_item.product.title | escape }}", | |
"", | |
"{{ line_item.vendor | escape }}", | |
"", | |
"{{ line_item.variant.title | escape }}", | |
{% if line_item.original_price != 0 %} | |
"{{ line_item.original_price | divided_by: 100.00 }}" | |
{% else %} | |
"{{ line_item.price | divided_by: 100.00 }}" | |
{% endif %}, | |
"{{ line_item.quantity }}", | |
"", | |
null, | |
"{{ currency }}" | |
); | |
{% endfor %} | |
snowplow( | |
"addEnhancedEcommerceActionContext:nb", | |
"{{ id }}", | |
"__nb_shopify.checkout_id", | |
"{{ total_price | divided_by: 100.00 }}", | |
"{{ tax_price | divided_by: 100.00 }}", | |
"{{ shipping_price | divided_by: 100.00 }}", | |
"{{ coupons | escape }}", | |
"", | |
null, | |
"", | |
"{{ currency }}", | |
); | |
snowplow("trackEnhancedEcommerceAction:nb", "purchase"); | |
} | |
})(); | |
</script> | |
<!-- End: Northbeam Shopify order status pixel --> | |
<!-- microsoft --> | |
<script> | |
(function(w,d,t,r,u) | |
{ | |
var f,n,i; | |
w[u]=w[u]||[],f=function() | |
{ | |
var o={ti:"187033303"}; | |
o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad") | |
}, | |
n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function() | |
{ | |
var s=this.readyState; | |
s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null) | |
}, | |
i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i) | |
}) | |
(window,document,"script","//bat.bing.com/bat.js","uetq"); | |
</script> | |
<script> | |
var productList = []; | |
{% for line in checkout.line_items %} | |
productList.push({{ line.product_id }}); | |
{% endfor %} | |
window.uetq = window.uetq || []; | |
window.uetq.push('event', '', {'ecomm_prodid': productList, 'ecomm_pagetype': 'purchase'}); | |
</script> | |
<script> | |
if (typeof _conv_host == "undefined") { | |
window["_conv_prevent_bodyhide"] = true; | |
(function() { | |
var _conv_track = document.createElement("script"); | |
_conv_track.src = "//cdn-4.convertexperiments.com/js/1004564-1004433.js"; | |
document.getElementsByTagName("head")[0].appendChild(_conv_track); | |
})(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment