This file contains 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> | |
window.dataLayer = window.dataLayer || []; | |
dataLayer.push({ ecommerce: null }); | |
dataLayer.push({ | |
event: "purchase", | |
ecommerce: { | |
transaction_id: "2909804026345", | |
value: 22.50, | |
tax: 2.50, | |
shipping: 10.00, |
This file contains 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
// Replace GTM-EXAMPLE with your GTM container ID | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer', 'GTM-EXAMPLE'); |
This file contains 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
function(){ | |
function getParameterByName(name, url = window.location.href) { | |
name = name.replace(/[\[\]]/g, '\\$&'); | |
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), | |
results = regex.exec(url); | |
if (!results) return null; | |
if (!results[2]) return ''; | |
return decodeURIComponent(results[2].replace(/\+/g, ' ')); | |
}if(getParameterByName("gclid")){ | |
return window.location.href.toLowerCase().replace("gclid="+getParameterByName("gclid").toLowerCase(),"gclid="+getParameterByName("gclid")); |
This file contains 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
function() { | |
if (window.performance && window.performance.getEntriesByType) { | |
var entries = window.performance.getEntriesByType("navigation"); | |
if (entries.length > 0) { | |
var navTiming = entries[0]; | |
var pageLoadTime = navTiming.loadEventEnd - navTiming.startTime; | |
return Math.round((pageLoadTime + Number.EPSILON) * 100) / 100; | |
} | |
} | |
} |
This file contains 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> | |
window.dataLayer = window.dataLayer || []; | |
dataLayer.push({ ecommerce: null }); | |
dataLayer.push({ | |
event: "purchase", | |
ecommerce: { | |
transaction_id: "4923535098040", | |
value: 27.50, | |
tax: 2.50, | |
shipping: 10.00, |
This file contains 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
function() { | |
if (window.performance && window.performance.getEntriesByType) { | |
var entries = window.performance.getEntriesByType("navigation"); | |
if (entries.length > 0) { | |
var navTiming = entries[0]; | |
var pageLoadTime = navTiming.loadEventEnd - navTiming.startTime; | |
return Math.round(((pageLoadTime / 1000) + Number.EPSILON) * 100) / 100; | |
} | |
} | |
} |
This file contains 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> | |
dataLayer.push({ ecommerce: null }); | |
dataLayer.push({ | |
event: "purchase", | |
ecommerce: { | |
transaction_id: "{orderId}", | |
value: {orderGrandTotal}, | |
currency: "USD" | |
} | |
}); |
This file contains 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
onclick="dataLayer.push({ 'ecommerce': null });dataLayer.push({ | |
'event': 'add_to_cart', | |
'ecommerce': { | |
'items': [{ | |
'item_id': '{{ product.id }}', | |
'item_name': '{{ product.title | remove: "'" | remove: '"' }}', | |
'item_brand': '{{ product.vendor | remove: "'" | remove: '"' }}', | |
'item_category': '{{ product.collections[0].title | remove: "'" | remove: '"' }}', | |
'item_variant': '{{ product.selected_variant.sku }}', | |
'currency': '{{ shop.currency }}', |
This file contains 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> | |
window.dataLayer = window.dataLayer || []; | |
dataLayer.push({ ecommerce: null }); | |
{% if first_time_accessed %} | |
dataLayer.push({ | |
event: "purchase", | |
ecommerce: { | |
transaction_id: "{{ checkout.order_id }}", | |
value: {{ total_price | times: 0.01 }}, | |
tax: {{ tax_price | times: 0.01 }}, |
This file contains 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
<!-- Google Tag Manager --> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
</script> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-EXAMPLE');</script> | |
<!-- End Google Tag Manager --> |
NewerOlder