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.b.ii.Click the โGet Started Todayโ button.
- 3.c.iii.Sign in with your Google account. If you donโt have one, create a new account.
- 4.d.iv.On the welcome page, click โStart Measuring.โ
Step 2: Set Up Your Account

- 1.a.i.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.b.ii.Scroll down and click Next.
Step 3: Create a Property

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

- 1.a.i.Select your Industry Category (e.g., Computers & Electronics).
- 2.b.ii.Choose your Business Size (e.g., Small for 1โ10 employees).
- 3.c.iii.Click Next.
Step 5: Choose Your Business Objectives

- 1.a.i.Select โOther Business Objectivesโ to enable all features.
- 2.b.ii.Click Create.
- 3.c.iii.Accept the Terms of Service and click I Accept.
Step 6: Set Up a Data Stream
- 1.a.i.On the โStart Collecting Dataโ page, select Web.
- 2.b.ii.Enter your website URL (without
https://or trailing slashes/). - 3.c.iii.Add a Stream Name (e.g., your website name).
- 4.d.iv.Click Create and Continue.
- 5.e.v.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.a.i.On the Web Stream Details page, locate your Measurement ID (starts with
G-). - 2.b.ii.Copy this IDโyouโll need it for the Next.js setup.
- 3.c.iii.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.a.i.Go to the Admin page by clicking the gear icon in the bottom-left corner of your Google Analytics dashboard.
- 2.b.ii.In the Admin section, click on โData Streams.โ
- 3.c.iii.On the Data Streams page, find the website youโre tracking and click on it.
- 4.d.iv.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
- 2.b.ii.You will see one or more accounts listed.
- 3.c.iii.Select your organization, and then click on the container where you want to add Google Analytics.
- 4.d.iv.It will take a couple of seconds to load the container dashboard.
Step 2: Create a New Tag
- 1.a.i.In the Overview tab, find the box labeled New Tag.
- 2.b.ii.Click on โAdd a new tag.โ
- 3.c.iii.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.a.i.Click on the Tag Configuration box.
- 2.b.ii.A modal will open with many tag type options.
- 3.c.iii.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.a.i.In the Tag ID field, click the variable icon on the right.
- 2.b.ii.A modal will open. Click the plus (+) icon in the top right corner.
- 3.c.iii.Click on the default name โUntitled Variableโ and rename it to โGA4 Measurement ID.โ
- 4.d.iv.Click on Variable Configuration to open the variable type modal.
- 5.e.v.Scroll down to the Utilities section and select Constant as the variable type.
- 6.f.vi.In the Value field, paste your Google Analytics Measurement ID.
- 7.g.vii.Click Save (top right corner, dark blue button).
Step 5: Add a Trigger
- 1.a.i.Scroll to the bottom to find the Triggering section.
- 2.b.ii.If itโs not already selected, click the box and choose Initialization โ All Pages from the three options.
- 3.c.iii.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.a.i.Click Save in the top right corner of the tag configuration page.
- 2.b.ii.Youโll return to the dashboard.
- 3.c.iii.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
Just want to add Google Analytics ? Check this blog























