We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Conversion value data layer variable for Google Tag Manager

Conversion value data layer variable for Google Tag Manager

madshj
New Member
4 0 1

I'm trying to set up conversion tracking with Google tag manager, yet i cant seem to find the data layer variable that contains my total order value. When i head into my console on my thank you page to see my data layers, it doesn't show me anything related to the transaction. Anyone have a workaround for this?

Replies 2 (2)

Claud9
Shopify Partner
8 1 2

Hi @madshj you have to manually add the datalayer object to your additional scripts. 

Go to settings > checkout > additional scripts.

Frome there you can add a script to create a datalyer object and push a purchase event with all the relevant parameters.

e.g.

 

<script>

window.dataLayer = window.dataLayer || [];  // this initializes the datalayer

window.dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: "{{ checkout.name }}",
currency: "{{ checkout.currency }}",
value: {{ total_price | money_without_currency }}, // this is your total order value. Evaluate replacing decimal separator to dot notation 

items: items //here you have to put your item array if you want to track the items that have been purchased.
}
});

</script>

 

 

webhasan
Shopify Partner
2 0 0

If you need complete dataLayer you can check it. https://leomeasure.com/shopify-datalayer-gtm