Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi there, we're considering moving to Shopify (We're using Magento at the moment)
We also currently use Google Tag Manager (GTM) to integrate the javascript code for 3rd party apps, Analytics Tools and to setup tracking pixels and tags to track things like Conversions in Google Analytics, Adwords and BingAds.
In order to pass transaction values to Adwords and BingAds we needed to create a dataLayer in Magento which allows us to pull in the different data layer variables and their values.
We hope to create the same setup in Shopify (We will be using the Advanced plan) however I can't find any documentation which lists out the names for all of Shopify's data layer variables?
If anyone can point me in the right direction that would be great.
Hey there,
Interesting discussion. Did you try this app https://apps.shopify.com/google-tag-manager-by-niddocks I see this app can actually get datalayer data from Shopify, so you easily connect it with 3rd aprty services.
Hi Nathan
I've not looked at apps yet, but knowing that this uses the data layer must mean one exists.
But it would be much more useful to know what the individual variables are so I can create my own tags, triggers and potentially push missing data into the data layer from Google Tag manager.
For example, we currently have a tag setup to pull the cart total out of the data layer and push it into our livechat app so when a cart reaches £100 it triggers a chat to let the user know there is a special bulk order discount and to ensure we don't lose larger orders.
Any Shopify Developers or someone from Shopify able to jump in here?
I assume you've already reviewed the docs to see the Liquid objects, AJAX API and App API. What info are you unable to find or need beyond that?
Hi Jason, thanks for responding. I have searched https://developers.shopify.com for datalayer or "data layer" but it doesn't bring anything back that's relevant. Does Shopify refer to it by any other name?
You can create your own datalayers. I suggest ripping off the foundation of Segment: https://community.segment.com/t/k98abg/shopify-store-event-tracking-deprecated
Hope you switched from Magento to Shopify (booo Magento, you don't even work!).
Here's what you were looking for. Hopefully newcomers to this message find this helpful: https://shopify.dev/docs/themes/liquid/reference/objects
Hello, there.
Great question. We have prepared a special dataLayer code to be inserted on the checkout page. From there, you can use it on Google Tag Manager and pass the data to any parties (Google Analytics, Google Ads, Facebook Pixels, and so on).
You can check this video out and let me know if you have any questions.
Are you able to simply add liquid objects as datalayer variables in GTM? For instance if I set up product.title as a datalayer variable would that find the value?
You're able to add anything output by Liquid, in a script (e.g. for a data layer).
So with Javascript in Liquid you can create an object like this (don't forget the quotes):
const object = {
"title": "{{ product.title }}"
}
You should be able to see it in the HTML when you inspect the source of the page.
Yes - but you should make sure to push that as a data layer object later on. Have you reviewed the video I've shared earlier? It is a practical example of how things work there. Let me know if you have a question.