Complete guide how to setup GA4 on Shopify
Step 15. How to setup user ID for GA4 on Shopify
Upgrade your Reporting Identity providing User IDs because is a one of the method GA4 can associate events with users across different platforms. Thank to providing user ID from your Shopify Google knows that is the same user regardless form example which device they use.
If you want to track your users accurately implementing user ID to GTM is good decision. Here are all steps you need to do:
- You need to specify new data layer variable which will storage your Shopify user id. To do that you need to edit your theme.liquid template adding new variable: customer_id, in the customer details sections which we created before in this step: How to implement GA4 login event on Shopify, and then updated here: How to setup server side tracking for GA4 on Shopify
- Then you have add the same variable do your data layer in checkout additional java script code: Shopify>Settings>Checkout and accounts>Order status page>Additional scripts
and add there the customer_id variable to the GTM data layer section. - Then you have to create data layer variable: customer_id in your GTM using following setup:
- Then all you need to do is just to add this variable to “fields to set” section of your GA4 – Configutation Tag which we create here: How to implement GA4 Configuration tag in Google Tag Manager?
- Last step is just publish changes of your GTM container.
The next step of our guide is to: GA4 – conversion events
If you enjoyed the content please share it:
If you have any question about this topic feel free to comment or react below.
This guide is all about how to implement Google Analytics(GA4) on Shopify. To setup GA4 on Shopify website we use Google Tag Manger(GTM) and Shopify data layer.

If you want to measure traffic on your Shopify website, the first thing is to create Google Analytics account for your website


If you have Google Account but you don't have GA4 property yet, because for example you are still using Universal Analytics property (former version of GA4) you have to create new GA4 property.


Because we will use Google Tag Manger as a method to implement Google Analytics 4 you have to create GTM account.


If you want to get the best out of Google Analytics 4 apply the following recommended GA4 settings and best practices.


Environment - is a set of necessary elements of technical / software infrastructure, which is the basis for the operation of a given website/application. Google Tag Manager environments are simply multiple versions of the same container. When we have a website with a different version for development, testing, production and QA, instead of creating separate GTM containers for each version, we can set up separate environments in the same container that will work independently in each version.


Some time ago I listened to a podcast from the Technical Marketing Handbook series from Simo Ahava, whose guest was Adam Halbardier from the Google Tag Manager product team. During the conversation, the topic of transparency of data handled by the Server-Side container appeared.


If you plan email marketing campaigns you are interested in the same as with other campaigns, to measure their impact on your business. When you are starting with this topic it is good to know that without additional effort you will not be able to access this impact. You will see no results because Google Analytics will treat traffic from the email campaigns as direct traffic (when users are using your own app) or as referrals (when users are using web email clients).
