Shopify's Data Layer

Ecommer
Tourist
5 0 1

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.

 

Replies 11 (11)
Nathan_Le
Shopify Partner
72 0 12

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.

Facebook Ads, Google Adwords & Google Analytics - my passion and that's what I can help you with right now.
Ecommer
Tourist
5 0 1

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.

Ecommer
Tourist
5 0 1

Any Shopify Developers or someone from Shopify able to jump in here?

Jason
Shopify Expert
10873 190 2177

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?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Ecommer
Tourist
5 0 1

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?

Josh_Uebergang
Shopify Expert
853 30 213

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

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
AustinBecker
Tourist
8 0 4

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

ekuplu
Shopify Partner
39 0 6

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. 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
Cdalo89
Tourist
3 0 3

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?

FilipposD
Shopify Partner
45 1 18

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.

ekuplu
Shopify Partner
39 0 6

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. 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube