Perfectly add Google Analytics to a site to measure website data and gather visitor insights, using Google Tag Manager and verify that it is working properly
To add Google Analytics 4 to a site using Google Tag Manager and verify that it is working properly
Ideal outcome
Google Analytics 4 is properly added & configured 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
You need a Google Analytics 4 account created. If you haven’t created one yet then follow SOP 163 (web version). Also, you should have installed Google Tag Manager on your site. If you haven’t added Google Tag Manager to your site, you can check out our Google Tag Manager Installation SOPs for: • SOP 004 (web version) to Set up Google Tag Manager on WordPress • SOP 065 (web version) to Set up Google Tag Manager on Shopify • SOP 066 (web version) to Set up Google Tag Manager on Squarespace
Key steps
32 steps
What is inside
36 headings
1Get the measurement ID from Google Analytics 46
Login to your Google Analytics account.
Click "Admin".
Make sure you’ve selected the correct property (account) and select "Data Streams" under "Data collection and modification".
Select your website that you want to implement Google Analytics 4.
Click on the measurement ID to copy it on your clipboard.
You can paste it in a text editor or notepad. You will need this later on.
2Set up Google Tag Manager13
Go to Google Tag Manager and sign in with your account details.
Select the container that is set up on your website.
Go to "Tags".
Click "New" and rename your tag. It is recommended that it contains a mention of Google Analytics 4 as it would make it easier in the future to locate the tags you are looking for.
Click on the "Tag Configuration" icon and select "Google Tag".
Paste the Measurement ID that you copied from Google Analytics 4 earlier.
Next, scroll down and click on the trigger icon below to set up a trigger for this tag.
Select "Initialization- All Pages". This is to fire the Google Analytics 4 on all pages on your website (recommended).
You are now ready to save your settings by clicking "Save":
Next, go to the "Overview" on the sidebar, this is how your Google Tag Manager overview dashboard should look like:
If everything looks ok, you are now ready to hit "Submit".
In the Submission Configuration panel, you will be given the chance to add a name and description to this version. After you have done so, hit "Publish".
You will now be taken to see the summary of the changes you’ve just made. That's it!
3Verify your set-up with a Tag Assistant Companion7
Select the container that you have already set up.
Select "Preview".
A new tab will appear to connect a Tag Assistant to your site. Key in your website URL and click "Connect".
This will open a new window to verify your website with a debug parameter at the end of your website URL. We recommend closing this window and using an extension instead as explained below.
Next, download the "Tag Assistant Companion" extension from this link here.
Refresh the Google Tag Manager page and click "Preview" followed by "Connect" again.
Next, navigate through the pages of your website. The Tag Assistant Companion will automatically load your page events as seen on the left:
4Verify your setup inside Google Analytics6
Login to your Google Analytics 4 dashboard by heading over to Google Analytics
Click "Admin" from the bottom left corner and select "DebugView".
Alternatively, you may also verify through the real-time report under the "Report" icon on the sidebar.
In another Google Chrome tab or window open up your website URL.
Now go back to the Google Analytics 4 tab and wait a few seconds.
You should see (at least) 1 active user on the website: