How to Connect Google Analytics 4 to Tag Manager
Sending data from your website to Google Analytics 4 is fundamental to understanding your audience, but the best way to do it is with Google Tag Manager. Using GTM gives you a flexible and powerful foundation for all your web tracking. This tutorial will walk you through, step-by-step, how to set up the GA4 Configuration tag on your site using Google Tag Manager.
First, Why Should You Use Google Tag Manager for GA4?
Before jumping into the “how,” it’s useful to understand the “why.” Connecting GA4 through Tag Manager isn't just one way to do it - it's the smart way. Unlike adding the GA4 tracking code directly to your site's HTML, GTM acts as a middle-layer, giving you more control and capabilities.
- Centralized Tag Management: Google Analytics is likely not the only script you need on your site. You probably have pixels for Facebook Ads, LinkedIn, Google Ads, and others. GTM keeps all these "tags" tidy in one place, so you don’t have to bother a developer every time marketing needs a new tracking script added.
- Powerful Event Tracking: Basic GA4 installation tracks page views, but what about button clicks, form submissions, or PDF downloads? With GTM, you can set up tracking for almost any user interaction, often without writing a single line of code, by using built-in triggers.
- Testing and Debugging Tools: GTM comes with a fantastic Preview mode that lets you see exactly which tags are firing on your site in real-time before you publish them. This helps you catch errors and ensure your data collection is accurate before it goes live for all your users.
- Version Control: Every time you publish changes in GTM, a new version is saved. If you accidentally break something, you can easily roll back to a previous, working version. This safety net is invaluable.
What You'll Need Before You Start
To make this process smooth, make sure you have these three things ready to go. Getting them in order now will save you from having to pause and search for details later.
1. A Google Analytics 4 Property and Data Stream
This tutorial assumes you already have a GA4 property set up. If you don't, you'll need to create one first inside your Google Analytics account. During the setup process, you'll create a "Web Data Stream," which represents your website's data flowing into GA4.
2. Your GA4 Measurement ID
Your Measurement ID is a unique identifier that tells Google Tag Manager where to send the data it collects. It always starts with "G-" followed by a string of letters and numbers (e.g., G-XYZ123ABC).
To find your Measurement ID:
- Open your Google Analytics account.
- Go to the Admin section (the gear icon in the bottom-left).
- In the Property column, make sure your desired GA4 property is selected.
- Click on Data Streams.
- Click on your web data stream for your website.
- Your Measurement ID will be displayed in the top-right corner. Copy it - you'll need it in a moment.
3. A Google Tag Manager Container Installed on Your Website
This is the engine for all your tags. If you haven't already, you’ll need to create a GTM account and a "Container" for your website at tagmanager.google.com.
After creating the container, GTM will provide you with two small code snippets. These must be installed on every page of your website you want to track. One snippet goes high up in the <head> section of your HTML, and the other goes right after the opening <body> tag. If you use a platform like WordPress, there are plugins that make this installation easy.
Step-by-Step: Connecting GA4 to Your Website with GTM
With your Measurement ID copied and GTM installed, you're ready to create the actual connection. This process involves creating a single "tag" and a single "trigger" inside your GTM container.
Step 1: Create a "GA4 Configuration" Tag
The first step is to create the main tag that initializes GA4 on your website. This tag is the foundation - it's what loads the Analytics tracking script and sets basic configurations like which GA4 property to send data to.
- Log in to your Google Tag Manager account and open your website's container.
- From the main workspace, select Tags from the left-hand menu.
- Click the New button to create a new tag.
- Name your tag something clear and descriptive. A good convention is "GA4 - Configuration". This makes it easy to identify later.
- Click inside the Tag Configuration box to choose a tag type.
- From the list, select Google Analytics: GA4 Configuration.
- In the Measurement ID field, paste the "G-" ID you copied earlier from your GA4 data stream.
You can leave the other settings as they are for now. The setting "Send a page view event when this configuration loads" should be checked by default. This ensures that every time the tag fires, it automatically sends a page_view event to GA4.
Step 2: Set the Trigger to Fire on "All Pages"
Now that you've told GTM what to do (load GA4), you need to tell it when to do it. This is where triggers come in. For the main configuration tag, you want it to fire on every single page of your website as soon as possible.
- Below the Tag Configuration box, click inside the Triggering box.
- From the available triggers, select All Pages. The official Trigger Type for this is "Initialization - All Pages," which is designed to fire before other tags, making it ideal for this purpose. If you select "All Pages - Page View," that will also work fine for this basic setup.
- After selecting the trigger, your setup is complete. Click the blue Save button in the top-right corner.
You now have a tag that loads your GA4 script and a trigger that tells it to fire on every page of your site. But don't click publish yet! Always test first.
Step 3: Preview and Test Your Setup
Blasting a new tag out to your live site without testing is a common mistake that can lead to broken tracking and bad data. GTM's Preview mode is your best friend here.
- In the top-right corner of your GTM workspace, click the Preview button.
- A new tab will open. Enter your website’s URL and click Connect.
- Your website will open in another new browser tab with a "Tag Assistant Connected" badge in the corner. Go back to the Tag Assistant tab.
- On the summary screen, you should see your "GA4 - Configuration" tag listed under the Tags Fired section. If you see it there, congratulations! It’s working as expected.
- For final confirmation, head over to your GA4 property and open the Realtime report (Reports > Realtime). You should see yourself as an active user. You may also see the
page_viewevent appearing under the Events card. This proves that GA4 is receiving data from your site via GTM.
Step 4: Publish Your Changes
Once you’ve confirmed everything is firing correctly in Preview mode, it's time to make your changes live for all of your website visitors.
- Go back to your GTM workspace and click the blue Submit button in the top-right corner.
- You'll be prompted to provide a Version Name and optional Description. Always fill this out with something descriptive, like "Added GA4 Configuration Tag." This creates a clear history of your changes in case you ever need to revert to an older version.
- Click Publish.
That's it! Your website is now officially connected to Google Analytics 4 through the power of Google Tag Manager.
What's Next? Setting Up GA4 Event Tags
Now that your foundation is in place, you can start tracking meaningful user interactions. While the Configuration tag handles page views automatically, other actions require their own "GA4 Event" tags.
For example, to track when someone clicks a link to an external website, you would create a new tag:
- Tag Type: Google Analytics: GA4 Event
- Configuration Tag: G-XYZ123ABC (select your main config tag)
- Event Name: A descriptive name like
outbound_link_click - Trigger: You would set this to fire only when a link click occurs and the URL does not contain your own domain.
This is where GTM's real power shines, allowing you to build a rich dataset of user behavior that goes far beyond simply knowing which pages were viewed.
Final Thoughts
By following these steps, you’ve created a clean, maintainable, and powerful connection between your website and GA4. This setup not only gets you your baseline traffic data but also provides the perfect foundation for implementing more advanced tracking to capture the subtle interactions that truly drive your business.
Of course, connecting your data sources like Google Analytics is just the first step. The real challenge is turning all that data into useful insights efficiently. At Graphed, we built our platform to eliminate the struggle of manual reporting. Instead of spending hours in GA4's report builder or exporting CSVs to combine with data from Facebook Ads and Shopify, you can connect your accounts and simply ask for what you need in plain English. Just describe the dashboard you want to see - "show me my top traffic sources and their conversion rates from last month" - and we instantly build it, with live data that updates automatically.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.