How to Add Google Analytics 4 to Google Tag Manager

Cody Schneider8 min read

Adding Google Analytics 4 to your website using Google Tag Manager is the most efficient way to manage your analytics setup. This approach gives you a powerful, flexible foundation for tracking everything from page views to specific button clicks without ever having to edit your website’s code. This guide will walk you through the entire process step-by-step, helping you get your GA4 tracking live in minutes.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Google Tag Manager (and Why Use It for GA4)?

Think of Google Tag Manager (GTM) as a toolbox or container that lives on your website. Inside this container, you can add, remove, and manage different snippets of code - known as "tags" - from various third-party services like Google Analytics, Facebook Pixel, Google Ads, and more. Instead of asking a developer to hard-code each script onto your site, you just add them through the GTM interface.

Here’s why using GTM to install GA4 is the standard best practice:

  • Speed and Flexibility: You can add, edit, or remove tracking tags on your own without waiting for a developer. Need to track a new campaign? You can set up the tag and publish it in minutes.
  • Centralized Management: All your marketing and analytics scripts live in one organized dashboard instead of being scattered throughout your website’s code.
  • Advanced Tracking Made Easy: GTM simplifies the process of tracking specific user interactions like video plays, form submissions, and downloads, which can be complicated to implement directly in your site's code.
  • Error Prevention: GTM’s built-in Preview and Debug mode allows you to test your tags and see what's firing (or what's broken) on your site before you publish your changes live. This drastically reduces the chances of launching faulty tracking.

Step 1: Get Your GA4 Measurement ID

Before you can do anything in Google Tag Manager, you need the unique identifier for your Google Analytics 4 property. This is called the "Measurement ID" and it's what tells GTM where to send the data it collects.

If you've already created a GA4 property, finding your Measurement ID is simple.

  1. Navigate to your Google Analytics account.
  2. Click the Admin gear icon in the bottom-left corner.
  3. In the Property column, make sure your desired GA4 property is selected.
  4. Click on Data Streams and select your web data stream from the list.
  5. Your Measurement ID (formatted as G-XXXXXXXXXX) will be in the top-right corner. Copy it - you’ll need it in the next step.

If you haven't created a GA4 property yet, you'll need to do that first. Just go to your Analytics Admin section, click "Create Property," follow the prompts to add your business details, and set up a new "Web" data stream. GA4 will generate the Measurement ID for you at the end of that process.

Step 2: Create the GA4 Configuration Tag in GTM

The "GA4 Configuration" tag is the foundational tag. Its main job is to initialize the Google Analytics tracking script on every page of your website. It also automatically tracks page views when it loads. All other GA4 event tags you create will use this configuration tag as their destination.

Let's set it up now.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

1. Create a New Tag

Log in to your Google Tag Manager container. From the main Workspace, navigate to Tags in the left-hand menu and click the New button.

2. Name Your Tag

Give your tag a clear, descriptive name. This will save you headaches later when you have many tags in your container. A good convention is GA4 - Configuration or Google Analytics - GA4 Base.

3. Select the Tag Type

Click inside the Tag Configuration box. From the slide-out menu of tag types, choose Google Analytics: GA4 Configuration.

4. Enter Your Measurement ID

In the "Measurement ID" field, paste the ID you copied from your GA4 data stream in the previous step (G-XXXXXXXXXX). For now, you can leave the other settings as they are. The checkbox for "Send a page view event when this configuration loads" should be checked by default - leave it that way to automatically track page views.

Pro-Tip: To make managing your ID easier, create a constant variable for it. Just click the "plus brick" icon next to the Measurement ID field, create a new "Constant" variable, paste your ID into it, and save it. Now you can select that variable here and in any future GA4 tags without having to paste the raw ID every time.

5. Set the Trigger

Next, you need to tell GTM when to fire this tag. Click inside the Triggering box at the bottom.

From the list of available triggers, select Initialization - All Pages. This special trigger is designed to fire before all other tags (except for consent tags), ensuring your GA4 script is loaded as early as possible on every page of your site. This is crucial for accurate data collection.

Once you’ve selected the trigger, click Save in the top-right corner to save your new tag.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 3: Track Specific Actions with a GA4 Event Tag

With the Configuration tag in place, you're now tracking page views across your entire site. But the real power of analytics comes from tracking specific user actions, or "events." This could be anything from a form submission to a newsletter signup button click.

The "GA4 Event" tag is used for this purpose. Let's create an example event to track clicks on a "Request a Demo" button.

1. Create a New Event Tag

In GTM, go back to Tags and click New. Name this tag something descriptive like GA4 - Event - Demo Request Click.

2. Configure the Event Tag

Click inside the Tag Configuration box and choose Google Analytics: GA4 Event from the tag type list.

In the "Configuration Tag" dropdown menu, select the GA4 Configuration tag you just created (GA4 - Configuration). This crucial step tells GTM which GA4 property to send this event to.

Next, provide an Event Name. This should be a short, descriptive name in lowercase with underscores for spaces (e.g., request_demo or generate_lead). Google provides a list of Recommended Events which you should try to use when possible, as they can unlock special reports in GA4.

3. Create a Trigger for the Event

Now, let's create a trigger to fire this tag only when someone clicks the specific "Request a Demo" button.

  • In the Triggering section, click the + icon to create a new trigger.
  • Name the trigger Click - Demo Request Button.
  • For the trigger type, choose All Elements under the Click section.
  • Change the trigger to fire on Some Clicks.
  • Set the condition to fire when Click Text contains Request a Demo. This tells GTM to only listen for clicks where the button text includes that phrase.

Click Save to save the trigger, and then save your new GA4 Event tag.

Step 4: Test, Verify, and Publish Your Container

Never hit publish without testing your setup first. GTM's Preview mode is your best friend for making sure everything works as expected.

1. Start Preview Mode

In the top-right of your GTM workspace, click the Preview button. A new tab will open asking for your website’s URL. Enter it and click Connect.

Two windows will open: one is your website with a "Tag Assistant Connected" badge, and the other is the Tag Assistant debug window.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

2. Verify Your Tags

In the Tag Assistant window, click on the "Initialization" event in the left-hand summary. You should see your GA4 - Configuration tag listed under the "Tags Fired" section. If you see it there, congratulations! Your base GA4 tag is working correctly.

Now, go back to your website tab and click the "Request a Demo" button. In the Tag Assistant window, a "Click" event should appear in the summary. Click on it, and you should see your GA4 - Event - Demo Request Click tag in the "Tags Fired" section.

You can also open up Google Analytics and navigate to Realtime reports. You should see your user activity and the page_view and request_demo events appear there within a minute or two.

3. Publish Your Changes

Once you've confirmed that both your Configuration tag and your Event tag fire correctly, you're ready to go live. Go back to your GTM workspace and click the blue Submit button in the top corner.

Give your version a descriptive name (e.g., "Install GA4 Configuration & Demo Click Event") and add a brief description of the changes you made. This is essential for keeping a historical record. Finally, click Publish to push your changes to your live site.

Final Thoughts

Connecting GA4 to your site with Google Tag Manager sets you up with a scalable and powerful foundation for your analytics. By using the GA4 Configuration tag for sitewide tracking and GA4 Event tags for specific interactions, you can capture a comprehensive picture of not just who visits your site, but exactly what they do when they get there.

Getting your data into GA4 is the first step, but the real goal is to turn that data into clear, actionable insights without spending half your week wrestling with reports. At Graphed, we designed our platform to automate this. After connecting your tools like Google Analytics in just a few clicks, you can ask questions in simple language - like "show me a dashboard of a Facebook Ads funnel for the last 30 days" - and our AI data analyst builds an interactive, real-time dashboard for you in seconds, helping you get from data to decision in a fraction of the time.

Related Articles