If you're new to Google Analytics or Google Tag Manager, don’t worry – this guide walks you through how to install GA4 on your website using Google Tag Manager. No technical knowledge is needed.
Note: We strongly advise not adding the GA4 tracking code directly to your website. To comply with Consent Mode 2.0, all analytics and marketing tags must be loaded through Google Tag Manager (GTM) so they can respond to the user’s consent choices.
What You’ll Need
Before you begin, make sure you have:
-
A Google Account (free)
-
Access to your website’s Google Tag Manager (GTM) account
-
A Google Analytics 4 (GA4) property set up (you can create one at analytics.google.com)
Why Use Google Tag Manager for GA4?
Installing GA4 via Google Tag Manager is highly recommended – especially now that Google Consent Mode 2.0 is a requirement for compliant data tracking in many regions, including the UK and EU.
Key Benefits:
-
Consent-Friendly Setup: GTM makes it easy to integrate GA4 with a compliant cookie banner (like Cookiebot or OneTrust), ensuring data is only collected once a user gives proper consent.
-
Google Consent Mode 2.0 Support: GTM allows you to set and modify
ad_storageandanalytics_storagesettings based on a user’s consent – a key requirement for Consent Mode 2.0. -
Flexible Management: You can add, pause, or update tags centrally without needing to touch your website’s code.
-
Future-Proofing: As privacy regulations evolve, GTM makes it much easier to stay compliant.
💡 Note: If GA4 is installed directly in your website’s code (rather than through GTM), you lose many of these consent-based controls – and risk falling foul of GDPR and other privacy laws.
For more help on setting up cookie consent properly, see our related guides:
- Understanding Cookie Compliance: Why It Matters & How It Affects Your Data
- Cookie Consent for UK Event Websites and Third-Party Forms
Tag Manager Steps
Step 1: Log into Google Tag Manager
-
Go to tagmanager.google.com and sign in.
-
Open the correct container for your website.
Step 2: Create a GA4 Configuration Tag
-
In the left-hand menu, click “Tags”.
-
Click “New” to create a new tag.
-
Click on “Tag Configuration”.
-
Select “Google Analytics: GA4 Configuration”.
Step 3: Find and Enter Your Tag ID
-
In a new browser tab, go to analytics.google.com.
-
Choose your GA4 property.
-
Click “Admin” in the bottom-left corner.
-
Under “Data Streams”, click on your website stream.
-
Copy the Tag ID (it will look like
G-XXXXXXXXXX). -
Return to GTM and paste the ID into the Tag ID field.
Step 4: Set the Trigger
-
Below the Tag ID field, click “Triggering”.
-
Choose “All Pages”. This tells GTM to fire the GA4 tag on every page of your website.
-
Click “Save” and name your tag something like “GA4 – All Pages”.
Step 5: Preview and Test in GTM
Before publishing, it’s a good idea to test whether the tag is working.
-
In GTM, click “Preview”.
-
Enter your website URL and click Connect.
-
Your website will open in a new tab. Return to Tag Assistant and check if your new GA4 tag is firing.
📷 See screenshot:
Step 6: Test Your Installation in GA4 (Optional but Recommended)
You can also test your tag directly inside Google Analytics:
-
Go to analytics.google.com and open your GA4 property.
-
Click Admin > DebugView.
-
On your website, click around to simulate user activity.
-
Go back to DebugView and check if your activity appears.
📷 See screenshot:
Step 7: Submit and Publish Your Changes
Once everything is working:
-
In GTM, click “Submit” (top-right).
-
Optionally add a version name like “GA4 setup”, then click “Publish”.
That’s It!
Your website is now connected to Google Analytics 4 using Google Tag Manager – and, importantly, it’s set up in a way that can handle proper consent from your users.
Need Help?
If something’s not working:
-
Double-check your Tag ID is correct
-
Use Preview mode in GTM to confirm the tag is firing
-
Check the DebugView in GA4 for live user activity
-
Review our guides on Consent Mode and Cookie Banners (linked above)
Troubleshooting: Google Analytics Not Working Properly?
If you’ve installed GA4 via Google Tag Manager but aren’t seeing data in your reports, the issue might be cookie consent.
To comply with Consent Mode 2.0, GA4 will not track users unless a compliant cookie banner is in place and properly configured to pass consent signals.
Check the resources below to make sure your setup is correct:
Without a compliant banner, Google Analytics may appear broken, even if GTM is installed correctly.
Comments
0 comments
Please sign in to leave a comment.