How to Connect Google Tag Manager to Google Analytics
Ditching the need to hard-code tracking scripts directly onto your website is one of the best upgrades you can make to your analytics workflow. By connecting Google Tag Manager to Google Analytics, you can manage all your tracking tags from one central dashboard without ever having to bug a developer. This article will walk you through exactly how to set up the connection and start tracking your first custom event.
A Quick Refresher: GA4 vs. Google Tag Manager
Before we get into the setup process, let's quickly clarify the roles these two powerful tools play. They work together but serve very different purposes.
What is Google Analytics 4?
Google Analytics 4 is the reporting and analytics platform. Its job is to collect, process, and display data about what users are doing on your website or app. It answers questions like:
- How many people visited my website yesterday?
- Which pages are the most popular?
- Where is my website traffic coming from?
- What is my conversion rate for newsletter signups?
Think of GA4 as the destination for your data. It’s where you go to actually see and analyze the user behavior you're tracking.
What is Google Tag Manager (GTM)?
Google Tag Manager is a tag management system. It doesn’t do any reporting or analysis itself. Instead, it acts as a container or a “toolbox” that holds all your third-party tracking scripts (called 'tags'). This includes your Google Analytics tag, Facebook Pixel, LinkedIn Insight Tag, and much more.
Instead of placing a dozen different code snippets directly into your website's source code, you install the Google Tag Manager script <em>once</em>. From that point on, you deploy, update, and manage all other tags from within the GTM interface. It simply "injects" the necessary scripts onto your site when specific conditions are met.
Top Reasons to Connect GA4 Through GTM
You can install the GA4 tracking code directly on your site, so why add a middleman like GTM? There are several massive benefits that make this the preferred method for modern marketing and analytics.
- Centralized Tag Management: Without GTM, every time you want to add or change a tracking pixel - like for a new ad platform - you have to edit your website's code. With GTM, you can manage everything from one place, clicking buttons instead of writing code.
- Easier Event Tracking: Want to track who's clicking your "Request a Demo" button or how many people watch your embedded product video? In the past, this required custom JavaScript. With GTM's built-in triggers and variables, you can set this up in minutes.
- Improved Site Performance: GTM loads your tags asynchronously, which means it doesn't hold up the rest of your page content from loading. This can contribute to a faster, better user experience.
- Testing and Debugging Tools: GTM’s built-in Preview mode lets you see exactly which tags are firing on your site in real time, before you publish them live. This makes troubleshooting a technical issue much, much easier.
- Future-Proof Your Setup: Once GTM is installed, adding new tools is incredibly easy. If you decide to start running Reddit Ads or want to add a heatmap tool, you simply add a new tag in your container. No developer needed.
Step-by-Step Guide: Connecting GA4 Through GTM
Now for the main event. We'll break down the connection process into five clear steps. The goal is to send a basic pageview from your website, through GTM, and into your GA4 property.
Step 1: Find Your GA4 Measurement ID
First, you need a specific ID from Google Analytics that tells GTM where to send the data. This is your "Measurement ID."
- Log in to your Google Analytics account.
- Click the Admin icon (the gear) in the bottom-left corner.
- In the Property column, make sure your correct GA4 property is selected.
- Click on Data Streams, then click on the web stream for your website.
- In the top-right corner, you'll see your Measurement ID, which starts with "G-". Copy this ID to your clipboard.
That's the only piece of information we need from GA4. We'll now do the rest of the work in Google Tag Manager.
Step 2: Create a Google Tag in GTM
Next, we will create the tag responsible for loading the GA4 script on your site. This is now called the "Google Tag" inside GTM and serves as the primary configuration tag.
- Navigate to your Google Tag Manager workspace.
- Click on Tags in the left-hand navigation menu.
- Click the New button to create a new tag.
- Give your tag a descriptive name. Something like "GA4 Configuration - Base Tag" is a good practice.
- Click inside the Tag Configuration box to choose a tag type.
- Select Google Analytics: GA4 Configuration.
- In the Measurement ID field, paste the GA4 Measurement ID you copied in the previous step. Leave the other settings as their default for now.
This tag now knows what to do (load GA4), but it doesn't know when or where to do it. That’s what triggers are for.
Step 3: Add a Trigger to Fire the Tag
A trigger is a rule that tells a tag when to fire. For our base GA4 setup, we want it to fire as early as possible on every single page of our website.
- While still editing your new tag, click inside the Triggering box at the bottom.
- Choose the All Pages trigger.
This is the ideal trigger for a base pageview tag because Google recommends it fires before any other triggers (except for consent-related tags), making sure that GA4 is loaded and ready to receive data from any other event tags that might fire after it.
Now, click Save in the top-right corner to save your new tag and trigger combination.
Step 4: Use Preview Mode to Test Your Tag
Never publish anything without testing it. GTM's Preview mode is your best friend for making sure everything works as expected before impacting your live site data.
- In the main GTM workspace interface, click the Preview button in the top right.
- A new browser tab will open for the Tag Assistant. Enter your website’s URL and click Connect.
- Your website will open in another new tab, with a "Tag Assistant Connected" badge in the corner.
- Go back to the Tag Assistant tab. On the left side, click on "Initialization".
- Under the Tags Fired section, you should see your "GA4 Configuration - Base Tag". This is your confirmation that it worked correctly!
You can also go to your GA4 property and look at the "Realtime" report. You should see yourself as a visitor, confirming that the data is being sent and received successfully.
Step 5: Submit and Publish your Changes
Once you’ve confirmed the tag is firing correctly in Preview mode, it's time to set it live.
- Go back to your GTM workspace tab.
- Click the blue Submit button in the top-right corner.
- A new panel will slide out. Provide a descriptive Version Name (e.g., "Deployed GA4 Base Tag") and feel free to add a more detailed description. This helps you keep a log of changes over time.
- Click Publish.
Congratulations! Your Google Tag Manager container is now actively sending pageview data to your Google Analytics 4 property.
Next Step: Tracking a Custom Event
Now that the connection is live, you can see the real power of GTM. Let's create a simple event tag to track when someone clicks on a "Learn More" button.
1. Create the Event Trigger
First, we need to tell GTM what a "Learn More button click" looks like.
- In GTM, go to Triggers and click New.
- Name it something like "Click - Learn More Button".
- For Trigger Configuration, choose Click - All Elements.
- Under This trigger fires on, select Some Clicks.
- You now set the conditions. Let's say your button's text is "Learn More." Set the rule to fire when: Click Text -> contains -> "Learn More".
- Save the trigger.
2. Create the GA4 Event Tag
Next, we create a tag that sends data to GA4 when that trigger condition is met.
- Go to Tags and click New.
- Name the tag "GA4 Event - learn_more_click".
- In Tag Configuration, choose Google Analytics: GA4 Event.
- For Measurement ID, select your existing GA4 base tag from the dropdown list. You don't need to manually enter the ID again.
- For Event Name, enter a unique name using lowercase letters and underscores. Per Google's recommendations, something like "learn_more_click" is perfect.
- Attach the trigger you just created by clicking the Triggering box and selecting "Click - Learn More Button".
- Save the tag.
Finally, run through the Preview -> Test -> Submit and Publish workflow again. You'll now be tracking those button clicks as events in your GA4 property, viewable under the "Events" section of your reports.
Final Thoughts
Setting up Google Analytics through Google Tag Manager gives you a flexible and powerful foundation for all your future tracking needs. You've centralized your tag deployment, making it easier to manage scripts, track user interactions, and test everything thoroughly without relying on a developer for every single change.
Of course, collecting all this data is just the first step. Once your data starts flowing into GA4 and all your other marketing tools, the challenge becomes making sense of it all. We built Graphed to simplify that process. By connecting your Google Analytics, ad platforms, and CRM in one place, you can ask questions in plain English like, "show me a dashboard comparing Facebook Ads spend vs. revenue last month" and get an answer in seconds. It allows you to skip the complicated reporting interfaces and go straight from data to decisions.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?