I will show you the easiest way to install Google Analytics with Google Tag Manager.
(Step-by-step)
What we are going to do is:
- Create a new Google Analytics tag
- Create a Universal Analytics tracking ID variable
- Add a page view trigger
- Preview your GA tag
- Publish your GTM container
Please note that using Google analytics with Google Tag Manager increases the size of data transfered and may introduce latency and increase the environmental impact of your website.
Create a Universal Analytics Tag
Sign in to Google Tag Manager
Click on “New Tag”
Click on Tag Configuration > Google Analytics : Universal Analytics
Create a Universal Analytics Tracking ID Variable
Now we will store the Google Analytics Tracking ID into a new variable so we don’t have to remember our tracking code every time we need to use it.
Click on “Select Settings Variable” > New Variable.
Add your Tracking ID that looks like this UA-XXXXXXXXX-1
. It can be found in Google Analytics > Admin > Property > Property Settings > Tracking ID.
Click Save.
Add a Page View Trigger
It is time to add a trigger to your tag. Triggering is setting the conditions where your tag will be executed.
Add a Trigger
Create a “Page View” Trigger that will fire on “All Pages”.
Click Save.
Preview Your Tag
Now it is time to preview if your tag is firing properly.
You should have the mention “Now previewing workspace”.
Open any page in your website.
A box should have opened at the bottom of the screen.
If your Google Analytics Tag is shown under “Tags Fired on This Page”.
Your tag was properly implemented.
Publish Your GTM Container
You are now ready to “leave preview mode” and click “submit” to publish your container.
Double-Check With Google Analytics Real-Time Report
If everything is fine, you should start seeing page views in your Google Analytics Real-Time Report.
To find out, go to Google Analytics > Real-Time > Content
Congratulations, you have now installed Google Analytics using Google Tag Manager (GTM).
SEO Strategist at Tripadvisor, ex- Seek (Melbourne, Australia). Specialized in technical SEO. Writer in Python, Information Retrieval, SEO and machine learning. Guest author at SearchEngineJournal, SearchEngineLand and OnCrawl.