Setting Up GTM And GA4 On Shopify

Find out everything you need to know about setting up Google Tag Manager and Google Analytics 4 on your Shopify store.

Contents

How do I set up GTM on Shopify?

How to set up GA4 in Google Tag Manager?

Testing in GTM 

Testing in GA4



How do I set up GTM on my Shopify store?


Install Google Tag Manager to get the code snippets that you will need to copy and paste into your Shopify store. Because Shopify uses templates, you only need to copy the snippets into the theme.liquid and checkout.liquid files.

If this is your first time installing Google Tag Manager, then use the installation steps provided by Google Tag Manager. Pause at the step where you are given two code snippets to add to your web pages, and then follow the instructions below.

 If you have already installed Google Tag Manager, then you can find these code snippets in your Google Tag Manager by clicking Admin, and then clicking Install Google Tag Manager.

 

  • In your Shopify admin, click Online store, and then click Themes.
    In the theme drop-down, click Edit Code.
  • Copy the first code snippet from Google Tag Manager into the <head> tags of your theme.liquid and checkout.liquid code:
    Copy the first code snippet from Google Tag Manager
  • In your Shopify admin, open your theme.liquid file.
  • Paste the code snippet as high in the <head> of the theme.liquid code as possible.
  • Open your checkout.liquid file.
  • Paste the code snippet as high in the <head> of the checkout.liquid code as possible.
  • Copy the second code snippet from the Google Tag Manager into the <body> tags of your theme.liquid and checkout.liquid code:
    In your Shopify admin, open the theme.liquid page.
  • Paste the code snippet as high in the <body> of the theme.liquid page as possible.
  • Open the checkout.liquid page.
  • Paste the code snippet as high in the <body> of the checkout.liquid code as possible.
  • In your Shopify admin, click Save.

How do I set up GA4 on Google Tag Manager?

  • Looking to set up the new Google Analytics 4 in Tag Manager? Follow the below instructions: 
  • Create a GA4 Property
  • Settings / Admin -> Data Streams
  • Add Stream -> Web OR if there is one present skip this step (should look like below when set up correctly.)
  • Once set up, click on that stream and copy the measurement ID
  • Move to GTM
  • Select the customer's profile from the drop-down to avoid any confusion
  • Select 'tags' in side nav -> New
  • Clearly name the tag GA4 Config. [Measurement ID] to avoid any confusion at a later date.
  • Click edit -> select GA4 Configuration option
  • Paste in the measurement ID into the box
  • Click to edit the Trigger section
  • Select "All Pages"
  • SAVE!

Testing In Google Tag Manager

  • Click preview
  • Install extension in the top right-hand side, this will add an app extension to chrome
  • Enter site URL
  • Should take you to your site with the tag assistant pop up on the screen and then on the tag manager tab it should show that you are in preview mode.
  • Move between a few pages and remember where you have clicked etc
  • Check back in the GTM tab and see if the tracking is following all the steps you made.
  • Click on a few of the "container loaded" actions and see if it registers as "successful" where it states the tag


Testing in GA4

  • Download Google Analytics Debug Extension
  • Go into GA4 -> Configure -> Debug view
  • Check items here match what you had completed on-site
  • Click and check on a few to make sure events match up
Build your audience. Sell more products.

Talk to us about converting more sales

Let's talk strategy