Set up Google Analytics with GTM.
Your first tag. One setup and GA4 starts tracking page views, scrolls and outbound clicks on your website automatically. This guide shows every step, from finding your Measurement ID to checking the Realtime report.
One tag connects everything.
GTM fires the GA4 tag on every page load. GA4 receives the data and shows it in your reports.
What you need.
Three things. If any is missing, set it up first.
GTM installed on your website
You need a working Google Tag Manager container on your site. If you haven't done that yet, follow Guide 1: How to set up GTM first and come back here.
A Google Analytics 4 property
Go to analytics.google.com. If you don't have an account, click Start measuring and follow the steps: name your account, create a property (pick your country and time zone), and add a Web data stream with your website URL. Google creates the property and the data stream for you.
Your Measurement ID
This is the code that starts with G- followed by letters and numbers (e.g. G-ABC123XYZ). You will copy it from GA4 in Step 1 below. It tells GTM which GA4 property to send data to.
From Measurement ID to live data.
Follow these eight steps in order. The whole setup takes about five minutes.
-
Get your GA4 Measurement ID
Open Google Analytics (analytics.google.com). In the bottom-left corner, click the gear icon to open Admin. Under your property, click Data Streams, then click your web data stream (the one with your website URL).
At the top of the stream details page, you will see Measurement ID. It looks like G-ABC123XYZ. Click the copy icon next to it. You will paste this into GTM in Step 4.
- Don't have a data stream? Click Add stream, choose Web, enter your website URL and a name, then click Create stream. The Measurement ID appears immediately.
-
Open GTM and create a new tag
Go to tagmanager.google.com and open your container (the one installed on your website). In the left-hand menu, click Tags, then click the New button in the top-right corner.
-
Name the tag
At the top of the tag editor, click Untitled Tag and give it a clear name. Something like GA4 - Configuration or Google Analytics. The name is just for you — it does not affect how the tag works.
- Use a naming pattern you can stick with. When you add more tags later (Google Ads, Meta Pixel), clear names make it easy to tell them apart.
-
Choose the tag type
Click the large Tag Configuration area. GTM shows a list of tag types. Select Google Tag (it may also appear as Google Analytics or GA4 Configuration, depending on when your GTM workspace was last updated — they all do the same thing).
-
Enter your Measurement ID
In the Tag ID field, paste the Measurement ID you copied in Step 1 (the one that starts with G-). That is the only setting you need to fill in for the basic setup. Leave everything else at the default.
-
Set the trigger to All Pages
Scroll down and click the Triggering area below the tag configuration. Select All Pages. This means the GA4 tag will fire every time someone loads any page on your website.
Click Save in the top-right corner.
-
Test with Preview Mode
Before publishing, test it. Click the Preview button in the top-right of the GTM workspace. GTM opens Tag Assistant:
- Enter your website URL and click Connect.
- Your website opens in a new tab. Navigate around it normally.
- Go back to the Tag Assistant tab. Under Tags Fired, you should see your GA4 tag listed. If it appears under Tags Not Fired, check that your trigger is set to All Pages and that you saved the tag.
Once you see it firing, your setup is correct.
-
Publish the container
Close Preview Mode. Back in the GTM workspace, click Submit in the top-right corner. Give the version a name (e.g. "Added GA4 tag") and click Publish.
Your GA4 tag is now live. Every visitor to your website will start sending data to Google Analytics.
Enhanced Measurement.
Once GA4 is connected, it tracks these actions on its own. No extra tags needed in GTM.
Page views
Tracked every time a page loads. Always on — cannot be turned off.
Scrolls
Fires when someone scrolls to 90% of the page. Only the 90% threshold — not 25% or 50%.
Outbound clicks
Tracks clicks on links that go to a different website.
Site search
Tracks when someone uses your website's search bar (based on URL parameters like ?q=).
YouTube videos
Tracks play, progress and completion of YouTube videos embedded on your site.
File downloads
Tracks clicks on links to files like PDFs, spreadsheets and documents.
Custom events are not automatic.
Enhanced Measurement covers the basics. These common actions need their own tags in GTM.
| Action | Why it needs a custom setup |
|---|---|
| Contact form submissions | GA4 may detect some form interactions, but for reliable tracking of a specific form (like your enquiry form), create a custom event tag with a trigger that fires on form submission. |
| WhatsApp button clicks | These are outbound clicks, so GA4 may catch them. But if you want a named event (like "whatsapp_click") that you can mark as a key event in GA4, set up a dedicated tag. |
| Phone number clicks | Clicks on tel: links are not tracked by Enhanced Measurement. You need a custom click trigger and a GA4 event tag. |
| Specific button clicks | Any button that is not a standard link (like a "Book now" button that opens a form) needs its own trigger and tag. |
Setting up custom events is a more advanced topic. The Google Ads conversion tracking guide and Meta Pixel guide cover how triggers and custom events work in practice.
Common doubts.
Do I still need the GA4 code on my website if I use GTM?
No. If you set up GA4 through GTM, remove any direct gtag.js code from your website. Having both sends data twice, which inflates your numbers.
What is Enhanced Measurement?
Enhanced Measurement is GA4's built-in tracking for scrolls (at 90% depth), outbound clicks, file downloads, YouTube video engagement and site search. These are tracked automatically once GA4 is connected — no extra GTM setup needed. You can toggle each one on or off in GA4 under Admin, Data Streams, Enhanced Measurement.
How do I know GA4 is working?
After publishing your GTM container, open your website in a browser and then check the GA4 Realtime report (Reports, Realtime). You should see your own visit appear within a minute or two.
Can I track form submissions with this setup?
The basic GA4 tag tracks page views and Enhanced Measurement events. For reliable form submission tracking, you need a custom event tag in GTM with a trigger that fires when the form is submitted. That is a separate setup on top of what this guide covers.
What if I already installed GA4 directly on my website?
Remove the direct GA4 code (the gtag.js snippet) from your website first, then set up GA4 through GTM as shown in this guide. If you leave both, every visit and event is counted twice.
Related reading
- Guide 1: How to set up GTM on your website — the prerequisite for this guide
- Guide 3: Google Ads conversion tracking with GTM — track which ad clicks become enquiries
- All GTM guides — the full set of four guides
- Google Search Console for beginners — the reports to check after GA4 is running