The way you set up Google Analytics 4 on Shopify eCommerce tracking will depend on the version of Shopify you’re using. If you’re using Shopify Plus, then you can install the tracking code (or Google Tag Manager) on all of the pages of your Shopify store, including the checkout pages. And if you’re using the standard version of Shopify, then you can install Google Analytics on all the pages of your store, excluding the checkout pages.
To install Google Analytics 4 on the standard version of Shopify, you will need to follow the steps below. And you can also watch this tutorial:
1. ADD THE TRACKING CODE TO YOUR THEME
Navigate to ‘Online Store’, then ‘Themes’, and edit the theme. liquid file. You will then need to paste your tracking code between the head tags. Here’s an example of the code (important: you will need to replace the two instances of G-EXAMPLE with the measurement ID from your GA4 data stream):
2. ADD THE TRACKING CODE TO YOUR ORDER CONFIRMATION PAGE
Navigate to ‘Settings’, then ‘Checkout’, add a modified tracking code to the ‘Additional Scripts’ section (under ‘Order Status Page’. Here’s an example you can use (important: you will need to replace the two instances of G-EXAMPLE with the measurement ID from your GA4 data stream):
3. EXCLUDE SHOPIFY AS A REFERRAL IN GA4
To ensure that your sales are attributed to the correct marketing channels, you will need to prevent the Shopify checkout pages from showing up as referrals in your reports. To do this, open your data stream in Google Analytics, then choose ‘More Tagging Settings’ and select ‘List Unwanted Referrals’. You will then need to enter myshopify.com as an exclusion.
4. ADD YOUR UNIVERSAL ANALYTICS PROPERTY ID TO SHOPIFY ECOMMERCE TRACKING
Since you won’t be able to see people traveling through the checkout pages in GA4, I recommend adding Universal Analytics to your Shopify store. To do this, navigate to ‘Online Store’, then ‘Preferences’, and add your property ID under ‘Google Analytics.