How to create a DataLayer on Shopify to use in Google Tag Manager

Posted By: Dylan Hunt

Published: February 23, 2020 16:05

I found this really really hard to find online, but was able to find a way to create a dataLayer with the variables I want to use in Google Tag manager for conversion tracking.

Below is the code you would enter in the additional content & scripts of then settings>checkout area of Shopify. This will allow you to create variables in google tag manager, that you can then use in the conversion tracking pixels.

Once you have added this, you will go to variables in Google Tag Manager and add a new variable. For Order value, I created one called OrderValue and then chose Data Layer Variable as the variable type, and entered ecomm__orderValue as the name, and kept the version at Version 2.

Once you add this, you can do the same for the order number, item quantity, and customer email. You can also add any additional lines that you want to the code above and capture more data if your pixel needs it.

Once the variables are created, add a new tag, and choose checkout conversion as the item to track, and then you can find these variables and enter them for the order value and so on.

Let me know if this worked for you or if anything was confusing and needed tweaking.

Need help implementing any of these guides?

Contact Me