How to submit Shopify checkout data to Google Tag Manager for order tracking

Home » Articles » Shopify » How to submit Shopify checkout data to Google Tag Manager for order tracking

Tracking orders from your Shopify store can be a bit tricky, but it’s essential for understanding your customers’ behaviour. By sending data from Shopify Checkout to Google Tag Manager (GTM), you can keep tabs on your orders more effectively. Here’s a simple guide to help you set this up.

How to set up custom pixel

The first step you’ll need is to create a custom pixel in Google Tag Manager.

  1. Log into your Google Tag Manager account and choose the account you want to use.
  2. Click on ‘Admin’, then ‘Install Google Tag Manager’ to get the installation code.
  3. Copy the code meant for the head section of a webpage, but remove the HTML tags.
  4. Use this modified code to create a new Shopify Custom Pixel.

Now that you’ve got your pixel set up, it’s time to make it listen for customer events. We’ll use the GTM dataLayer for this:

  1. In your custom pixel code, subscribe to customer events. For example, if you want to track completed orders, you’d subscribe to the ‘checkout_completed’ event.
  2. Use ‘analytics.subscribe’ and ‘window.dataLayer.push’ to send event data to the dataLayer.

How to set up Google Tag Manager

With your pixel ready to send data, you need to set up GTM to receive it:

  1. In GTM, create a new tag and trigger for your custom event (like ‘checkout_completed’).
  2. Set up dataLayer variables for the event details you want to capture, such as order ID, currency, and price.
  3. Make sure your trigger fires on all custom events and that your tag captures these dataLayer variables.

If you’ve already got dataLayer.push calls in your Shopify theme files, you’ll need to update these:

  1. Look for existing dataLayer.push calls in your theme.liquid or checkout.liquid files.
  2. Replace these with Shopify.analytics.publish() calls.

At this stage, we recommend consulting with a professional developer, as you are working on the critical theme.liquid file.

Conclusion

By following these steps, you’ll be able to track order data from Shopify Checkout using Google Tag Manager. This will give you valuable insights into your customers’ buying habits, helping you make better business decisions.

Remember, while this process might seem a bit technical, taking it step by step will make it manageable. And the payoff in terms of improved tracking and understanding of your orders is well worth the effort.

Wave

Enjoy our articles? Join our free list and get more.

Sign Up

Book Discovery Call