Shopify dataLayer (Checkout Extensibility) with GTM

Updated: Saturday, February 15, 2025

Recent changes on Shopify

Checkout Extenstibility

The migration to Checkout Extensibility has brought some consequential changes to the way tracking is carried out on Shopify.

The most important change is the implementation of a sandboxed JavaScript environment for the checkout and thank you pages.

To obtain functional tracking, it is now necessary to listen to customer events to find out what’s happening on pages present in the sandboxed environment.

Migration to Checkout Extensibility also brings changes to the way pages can be customized in the sandboxed environment.

flowchart LR
    subgraph abc [Customizable via <a href='https://shopify.dev/docs/api/checkout-ui-extensions' target='_blank'>Checkout UI extensions</a>]
        subgraph Sandboxed JavaScript environment
            D[Checkout page]
            E[Thank you page]
            F[Order status page]
            D-->E
            E-->F
        end
    end
    subgraph Customizable via theme.liquid
        subgraph Theme
            A[Collection page]
            B[Product page]
            C[Cart page]
            A-->B
            B-->C
        end
    end

Historical customization features

FeatureShopify classicShopify Plus
Customize theme✅ via theme.liquid✅ via theme.liquid
Customize checkout page✅ via checkout.liquid
Customize thank you page✅ via additional scripts.✅ via additional scripts.

Current personalization features

FeatureShopify classicShopify Plus
Customize theme✅ via theme.liquid✅ via theme.liquid
Customize checkout page✅ via Checkout Extensibility
Customize thank you page✅ via Checkout Extensibility

Application for GTM and dataLayer events

Click here to download the app to install GTM and DataLayer on your Shopify store.

Make sure you’re logged in to the right store, then click Install.

Addingwell application - GTM & DataLayer on the Shopify app store
Application Addingwell - GTM & DataLayer on the Shopify app store

Once the application is installed you’ll be taken to this page. Click Continue to start configuring the application.

Addingwell app home page - GTM & DataLayer
App home page

In the next step, check the Enable GA4 DataLayer with Standard eCommerce Events checkbox.

Enabling dataLayer events in the Addingwell - GTM & DataLayer app
Enabling dataLayer events in the Addingwell - GTM & DataLayer app

Next, check the Include GTM.js on Site Pages checkbox, then fill in the identifier of your GTM Web container (GTM-XXXXXXX).

Adding the GTM Web ID to be injected into the Shopify store
Adding the GTM Web ID to be injected into the Shopify store

You now need to activate the Shopify application in your store theme. To do this, click on the Enable Addingwell Script button.

Button to enable the Addingwell application in your store's theme
Button to enable the Addingwell application in your store's theme

Then activate the Addingwell GTM application in the theme editor. Save and return to the Addingwell application configuration.

Activating the Addingwell application in your store theme
Activating the Addingwell application in your store theme

A message is displayed in the application to confirm its activation in the theme.

Confirmation of Addingwell app activation in theme
Confirmation of Addingwell app activation in theme

We now add a custom pixel by copying the code displayed in the application.

Copy custom web pixel code
Copy custom web pixel code

Then go to Settings > Customer events and click on Add custom pixel.

Copy custom web pixel code
Copy custom web pixel code

Name your custom pixel with the name of your choice.

Naming the custom pixel
Naming the custom pixel

In the Customer privacy section, check the checkboxes as in the following screenshot.


Customer privacy settings in custom pixel
Customer privacy settings in custom pixel

Then paste the code you’ve copied from the Addingwell application and click Save.

Custom pixel code
Custom pixel code

Then click Connect to connect the custom pixel to the sandbox.

Button to connect custom pixel to sandbox
Button to connect custom pixel to sandbox

Congratulations, you’ve finished configuring the Addingwell GTM & DataLayer application. The DataLayer is now available in your theme and also in the sandbox pages (checkout + thank you page).

Debugging dataLayer events

In theme

To debug dataLayer events in the theme you can type dataLayer in your web console or use a browser extension. You’ll find more details in this blog post.

In the sandbox

To view the dataLayer in the sandbox, you need to open the web console in the custom pixel you’ve created. To do this, click on top in your web console.

Top button in web console
Top button in web console

A drop-down menu appears, select the window named web-pixel-sandbox-CUSTOM-{id}-LAX then type dataLayer in the console.

Viewing the dataLayer in the sandbox
Viewing the dataLayer in the sandbox

FAQ

Yes.
Yes, as soon as this information is available.