Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Last active February 3, 2022 16:03
Show Gist options
  • Save kmclaugh/675f0a00e621816ee02385cb8fa629ce to your computer and use it in GitHub Desktop.
Save kmclaugh/675f0a00e621816ee02385cb8fa629ce to your computer and use it in GitHub Desktop.
Shopify Buy Buttons - Thank You Page

Go to Settings > Checkout > Attional Scripts > Order status page.

Fill in YOUR CONTAINER ID

<!-- Google Tag Manager -->
<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','YOUR CONTAINER ID');</script>
<!-- End Google Tag Manager -->
<script>
window.dataLayer.push({
event: "eec.purchase",
ecommerce: {
currencyCode: "{{ currency }}",
purchase: {
actionField: {
id: "{{ order_number }}",
affiliation: "{{shop.name}}",
revenue:'{{checkout.total_price | money_without_currency| remove: ","}}',
tax: '{{checkout.tax_price | money_without_currency| remove: ","}}',
shipping: '{{checkout.shipping_price | money_without_currency| remove: ","}}',
},
products: [
{% for line_item in line_items %}
{
id: "{{ line_item.sku }}",
name: "{{line_item.title}}",
quantity: "{{line_item.quantity}}",
brand: "{{shop.name}}",
price: '{{line_item.price | money_without_currency | remove: ","}}',
},
{% endfor %}
],
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment