To add Google Analytics to a Shopify store and verify that it is working properly
Ideal outcome
Google Analytics is properly added without any technical issues
Why it matters
Google Analytics is the most popular tool to measure website data to gather visitor insights. With it, you will be able to know the amount of traffic you are getting, and how your visitors are behaving inside your website
Before you start
If you haven’t created your Google Analytics account, follow SOP 163 (web version) before following this SOP
Key steps
23 steps
What is inside
27 headings
1Retrieve Google Analytics 4 tracking code6
Login to your Google Analytics account .
Click “Admin”.
Make sure you’ve selected the correct property (website) and select “Data Streams”.
Select your website that you want to implement Google Analytics 4.
Click on the “Global site tag” to view the Google Analytics 4 tracking code.
Click the copy icon to copy the Google Analytics 4 tracking code.
2Adding the Google Analytics 4 tracking code to your Shopify Store5
Login to your Shopify store.
On your Shopify Admin Panel, click 'Online Store' followed by 'Themes'. Then, click on the three dots or kebab menu to reveal the options. Proceed to click 'Edit code'.
Click 'theme.liquid', and paste your Google Analytics 4 tracking code (that you copied earlier) right after '<head>'.
This is what it looks like after you’ve pasted the code. Then, click 'Save'.
Next, go back to your shopify store dashboard and click ‘Preferences’ under ‘Online Store’. Paste your code again in the description box of ‘Google Analytics account’. For existing users, remove your old code and replace it with the new code.
3Connecting Google Analytics 4 to your Shopify Store7
Look for ‘Apps’ on the sidebar and click it:
Next, search for google and look for ‘Google channel’.
Click on it to add the app into your shopify store.
Click ‘Add sales channel’ followed by ‘Connect Google account’.
Choose the corresponding email address or account that you have used for your Google Analytics 4 account.
Locate the illustrated box below and click ‘Get started’.
Select a Google Analytics 4 property that you have set up previously, click ‘Connect’ and you‘re done!
4Verify your setup inside Google Analytics 45
To test if the tracking code works, login to your Google Analytics 4 account .
You will be taken to your account dashboard.
Head to the real-time report under Report Real-time
You should see (at least) 1 active user on the website.
Verify the country where the user is from (it should be where you are currently located).