How to Add Google Analytics 4 to Google Tag Manager (Step-by-Step Guide with GA4 ID Setup)
Learn how to add Google Analytics 4 to your website using Google Tag Manager the right way. This step-by-step guide covers creating a GA4 property, getting the Measurement ID, and setting up tags with variables and triggers.
You first need to make a Google Analytics account and property. So let's do that.
If you already have one, you can skip this Google Analytics Account creation section.
Google Analytics Account Creation
Step 1: Create a Google Analytics Account
- 2.Click the “Get Started Today” button.
- 3.Sign in with your Google account. If you don’t have one, create a new account.
- 4.On the welcome page, click “Start Measuring.”
Step 2: Set Up Your Account

- 1.Fill in the Account Name (e.g., your business or website name).
Note: The account name is different from your Google Analytics ID. You’ll create a property under this account to track your website.
- 2.Scroll down and click Next.
Step 3: Create a Property

- 1.Enter a Property Name (e.g., your website domain name).
- 2.Adjust the Time Zone and Currency to match your location.
- 3.Click Next.
Step 4: Describe Your Business

- 1.Select your Industry Category (e.g., Computers & Electronics).
- 2.Choose your Business Size (e.g., Small for 1–10 employees).
- 3.Click Next.
Step 5: Choose Your Business Objectives

- 1.Select “Other Business Objectives” to enable all features.
- 2.Click Create.
- 3.Accept the Terms of Service and click I Accept.
Step 6: Set Up a Data Stream
- 1.On the “Start Collecting Data” page, select Web.
- 2.Enter your website URL (without
https://
or trailing slashes/
). - 3.Add a Stream Name (e.g., your website name).
- 4.Click Create and Continue.
- 5.Wait a moment—you’ll see the “Set up Google tag” page. Close it using the cross icon at the top.
Step 7: Copy Your Measurement ID

- 1.On the Web Stream Details page, locate your Measurement ID (starts with
G-
). - 2.Copy this ID—you’ll need it for the Next.js setup.
- 3.Close the setup page. Click “Next” then click “Go to Home” to open your Google Analytics dashboard.
If You Already Have a Google Analytics Account
If you already have an account and just need to find your Measurement ID, follow these steps:
- 1.Go to the Admin page by clicking the gear icon in the bottom-left corner of your Google Analytics dashboard.
- 2.In the Admin section, click on “Data Streams.”
- 3.On the Data Streams page, find the website you’re tracking and click on it.
- 4.This will take you to the Web Stream Details page where you can copy your Measurement ID (it starts with
G-
).
Connect Google Tag Manager to Google Analytics
Now that you have your Google Analytics Measurement ID, let’s add it to Google Tag Manager.
Step 1: Open Google Tag Manager
- 1.
- 2.You will see one or more accounts listed.
- 3.Select your organization, and then click on the container where you want to add Google Analytics.
- 4.It will take a couple of seconds to load the container dashboard.
Step 2: Create a New Tag
- 1.In the Overview tab, find the box labeled New Tag.
- 2.Click on “Add a new tag.”
- 3.A modal will open. Rename the tag by clicking the default title “Untitled Tag” — name it “Google Analytics Config” (as shown in the image).
Step 3: Configure the Tag
- 1.Click on the Tag Configuration box.
- 2.A modal will open with many tag type options.
- 3.From the Featured list, select the fourth item: Google Tag.
Step 4: Set the Measurement ID Using a Variable
Instead of pasting the Measurement ID directly, we’ll create a reusable variable.
- 1.In the Tag ID field, click the variable icon on the right.
- 2.A modal will open. Click the plus (+) icon in the top right corner.
- 3.Click on the default name “Untitled Variable” and rename it to “GA4 Measurement ID.”
- 4.Click on Variable Configuration to open the variable type modal.
- 5.Scroll down to the Utilities section and select Constant as the variable type.
- 6.In the Value field, paste your Google Analytics Measurement ID.
- 7.Click Save (top right corner, dark blue button).
Step 5: Add a Trigger
- 1.Scroll to the bottom to find the Triggering section.
- 2.If it’s not already selected, click the box and choose Initialization – All Pages from the three options.
- 3.This ensures your Google tag fires on all pages before any other tags — ideal for accurate pageview tracking and consent setup.
Step 6: Save and Publish
- 1.Click Save in the top right corner of the tag configuration page.
- 2.You’ll return to the dashboard.
- 3.At the top, click the Submit button to publish your changes to the live site.
Important Reminder
If Google Analytics is already installed directly on your website, make sure to remove it at the same time you publish this new setup.
Having both the manual GA tag and the GTM-based GA tag will result in duplicate tracking, which can cause issues.
So: remove the original tag and only use Google Tag Manager going forward.
Need help with that? I’ve also linked a blog below on how to add Google Tag Manager to a Next.js 15 project.
You’re Done!
You’ve now successfully added your Google Analytics tracking using Google Tag Manager!
If you’d like a visual walkthrough, here’s a great video that explains the same steps:
Related Blogs
Just want to add Google Tag Manager in your Next js project? Check out this blog

How to Add Google Tag Manager in Next.js 15 App Router (Official & Simple Method)
Learn how to integrate Google Tag Manager into your Next.js 15 App Router project using the official @next/third-parties package. This guide walks you through the latest and easiest method, no manual script tags, just clean integration.
Just want to add Google Analytics ? Check this blog

How to Add Google Analytics in Next.js 15 App Router (Official & Simple Method)
Learn how to easily add Google Analytics to your Next.js 15 App Router project using the official @next/third-parties library, no manual scripts, just a simple and modern setup.