Google Tag Manager and GA4 are not two versions of the same thing. GTM is the container that deploys and manages tags on your site, and GA4 is the platform that receives, stores, and reports the data. You need both, and the setup has a fixed order: property and data stream first, tag second.
This guide walks the whole path in the order you will actually do it. First the mental model, then the install in GTM, then the checks in GA4 that catch bad or missing data before you trust a single report.
The path in 7 steps
The steps of this page, in order.
-
01 Understand the split GTM deploys tags, GA4 stores and reports what they send.
-
02 Create the property Set up the GA4 property and web data stream before touching GTM.
-
03 Build the tag Add the Google tag in GTM and fire it on every page.
-
04 Test and publish Preview the container, confirm the tag fires, then publish.
-
05 Verify the data Check DebugView and Realtime to prove hits arrive.
-
06 Audit the settings Review retention, internal traffic, referrals, and conversions.
-
07 Decide who owns it Keep routine changes in-house and bring in help for the complex parts.
01 / 12
Is Google Tag Manager part of Google Analytics?
No. They are two separate Google products that do two separate jobs, and both are free to use at the standard tier.
Google Tag Manager (GTM) is a tag management system: it holds the code that runs on your pages and decides when each tag fires. A tag is a snippet of code that sends information somewhere, such as a pageview to GA4. A container is the GTM file you publish on your site; it holds all your tags and the rules for when they fire.
GA4 is the analytics platform: it receives the hits, stores them, and produces the reports you read. Neither replaces the other. A GA4 property with no tag sends nothing, and a GTM container with no GA4 destination collects nothing.
Google Tag Manager
A tag management system that deploys code on your pages and decides when each tag fires. You use it when you want to add or change tracking without editing site code every time.
- Job
- Deploy tags
- What it holds
- Tags, triggers, variables in a container
Key pointThink of GTM as the delivery mechanism, not the destination.
Google Analytics 4
The analytics platform that receives hits, stores them, and produces the reports you read. You use it when you want to see traffic, conversions, and user behavior.
- Job
- Store and report data
- What it needs
- A tag sending data to it
Key pointThink of GA4 as the warehouse and reporting layer, not the delivery mechanism.
02 / 12
What's the difference between the Google tag and gtag.js?
The Google tag is what you deploy today; gtag.js is the older code you no longer need if you use Tag Manager.
The Google tag is the single tag that sends data to your Google destinations, including GA4. Google's documentation notes that the old GA4 Configuration tag has been replaced by the Google tag, and existing configuration tags were automatically upgraded while event tags stayed the same. If you use GTM, you deploy the Google tag inside a container and skip the snippet entirely.
gtag.js is the legacy snippet you paste directly into your site's HTML. It only sends data to Google services and does not support third-party or custom tags, so it becomes a dead end the moment you want to track something non-Google. Google's recommended path is Tag Manager because it lets you add, edit, or pause tags without touching site code.
Google tag in GTM
- Centralizes all Google and third-party tags in one container
- Change or add tags without a developer deploy
- Supports custom and non-Google tags
- Requires initial GTM container setup
- Adds a learning curve for non-technical users
Best for most marketers and analysts who want control without waiting on developers.
Standalone Google tag
- No GTM container required
- Quick to add via site builder or CMS plugin
- Limited to Google destinations
- Each change may require editing site code or settings
Suitable if you only use Google tools and never expect to add non-Google tags.
Gtag.js (legacy)
- Familiar to anyone who used older GA implementations
- No support for third-party or custom tags
- Only sends data to Google services
- Google recommends migrating away from it
Avoid for new setups; use only if you are maintaining a legacy site and cannot migrate yet.
Going further
Read the rationale
Concept
Why Google recommends Tag Manager
Google recommends Tag Manager because a container lets you ship tag changes without a developer deploy.
A GTM container is a small snippet on your site that loads a configuration file hosted by Google. When you add or edit a tag in the GTM interface, you publish a new container version; the snippet on your site does not change. This means a marketer can add a conversion tag, adjust a trigger, or pause a tag in minutes, without opening a code editor or filing a ticket.
The container also keeps your tracking organized. You can group tags by purpose (analytics, ads, consent), test changes in Preview mode before publishing, and roll back to a previous version if something breaks. That separation of concerns is why Google positions GTM as the recommended path for deploying the Google tag and other measurement code.
- Publish accessConfirm who on your team can publish container versions; limit publish rights to avoid accidental changes.
- Workspace disciplineUse separate workspaces for major changes so you can review and test without affecting live tags.
- Version historyKnow how to roll back to a previous container version in case a new tag causes issues.
- Container snippet placementEnsure the GTM snippet is installed on every page, typically in the head and immediately after the opening body tag.
03 / 12
What do I need before I start?
Three things: admin access to the site, a Google account with edit rights on GTM, and a decision about who on the team owns tracking changes.
You need the ability to paste one container snippet into every page, usually through your CMS theme, a header plugin, or your host's settings panel. The container is the GTM file you publish on the site; it holds all your tags and the rules for when they fire.
Decide who owns the container. GTM lets you assign edit and publish permissions to a named person, so tracking changes do not queue behind a developer. Then follow one order: GA4 property and data stream first, the tag in GTM second.
Admin access to the site
You must be able to edit the site header or install a plugin, otherwise the container snippet has nowhere to go.
A Google account with GTM edit rights
You also need edit access to the GA4 property. Publishing rights are separate, so confirm you hold both.
A named owner for tracking
Pick the person who approves and publishes tag changes. GTM assigns permissions per person, not per agency.
A staging site, if you have one
Test the container there first so a broken tag never reaches live pages.
04 / 12
Should I create the GA4 property first or the GTM tag?
Always the property first. The tag needs a measurement ID that only exists once the property and its web data stream are created.
In GA4, create the property, then add a data stream, the GA4 connection to one source of data, such as your website. Copy the measurement ID it generates, usually formatted as G-XXXXXXXXXX.
Only then open GTM, create a Google tag, paste that ID, and attach the trigger that fires on all pages. Reversing the order means editing the tag again later, once the ID exists.
-
Create the GA4 property
In your Google Analytics account, create a new property and set the reporting time zone and currency. Who: the marketer or analyst with account access.
-
Set up the web data stream
Add a data stream for your domain, then open its details and copy the measurement ID. Who: same person, still inside GA4.
-
Create the Google tag in GTM
Open your GTM container, create a new Google tag, and paste the measurement ID into the Tag ID field. Who: whoever maintains the container.
-
Add the all-pages trigger
Attach a trigger that fires on every page view, such as the built-in All Pages trigger. Who: same GTM user.
-
Test in Preview mode
Use GTM Preview, load your site, and confirm the Google tag fires once per page load. Who: the person who created the tag, working with a browser session on the live site.
-
Publish the container
Once Preview shows the tag firing correctly, publish the container and verify data arriving in GA4 Realtime. Who: the same GTM user.
Going further
Show the reason
Method
Why the order cannot be reversed
Building the GTM tag before the GA4 data stream exists leaves the tag without a measurement ID, which means either a temporary placeholder or a stalled setup.
The Google tag does not query GA4 on its own; it carries the measurement ID that GA4 generates when the data stream is created. If you make the tag first, the Tag ID field is empty and the tag cannot send data. You might paste a placeholder, but the tag will not work until the real ID is in place.
The recovery is straightforward: go back to the tag, replace the placeholder with the real measurement ID from the data stream, and test again in Preview mode. It costs one extra round trip, but nothing breaks permanently.
- Measurement ID existsConfirm the data stream shows a G-XXXXXXXXXX ID before touching GTM.
- Tag ID matches exactlyPaste the ID into the Google tag's Tag ID field, with no extra spaces.
- Tag fires once per pageIn Preview mode, check the Tag Assistant summary shows one Google tag event per page load.
- Realtime shows activityAfter publishing, open GA4 Realtime and confirm your own visit appears within a minute.
05 / 12
Which trigger makes the tag fire on every page?
An All Pages trigger. If you pick anything else, the tag fires only on some pages and your reports silently go partial.
An All Pages trigger in GTM is the condition that tells a tag to fire on every page view. It's the default pairing for the Google tag, so keep your pageview tag scoped to it alone. If you attach it to a single page or a form-submit trigger, only those pages send data.
When you need clicks, scrolls, or form submissions, add a second trigger to a new tag instead of widening All Pages. This keeps the pageview clean and makes it obvious which tag is responsible when numbers look wrong.
All Pages
Fires on every page of your site. This is the trigger you pair with the Google tag for standard pageview collection. Choose it whenever the goal is catching every URL without conditions.
- Fires on
- Every page load
- Risk if misused
- None if kept alone; dilution if you add unrelated conditions
Key pointKeep this trigger on the Google tag and don't add filters here.
Page View (single URL)
Fires only when the URL matches a specific path or query. Useful for a one-off campaign page where you want a separate tag, not for your main tracking. It will never cover the rest of the site.
- Fires on
- One defined page
- Risk if misused
- Most pageviews missing; reports look partial
Key pointUse for exceptions only, never as your main pageview trigger.
Form Submit
Fires when a visitor submits a form. It's for conversion events, not for pageviews. If you attach your Google tag to this trigger, you'll only see data when forms are submitted.
- Fires on
- Form submission
- Risk if misused
- Pageview data drops to near zero between submissions
Key pointAdd a separate tag for form events and leave All Pages untouched.
Click, Just Links
Fires when a visitor clicks a link that points away from your site. It's useful for outbound tracking, but it's not a pageview. Applying it to the Google tag means only outbound clicks trigger data.
- Fires on
- Link click
- Risk if misused
- No pageviews; only click events recorded
Key pointKeep it on a dedicated outbound-click tag.
06 / 12
Do I have to use preview mode, or can I publish?
Preview first, publish second. Publishing without previewing is how duplicate tags and broken tags reach production.
Preview mode loads your site with the unpublished container, the GTM file that holds your tags and the rules for when they fire, so you can see exactly which tags trigger, page by page, before any real visitor is affected. A tag that stays in preview only never reaches your live site, so reports look empty and people start re-adding tags, which is how duplicates are born.
The classic failure is a double-counted pageview: two Google tags in one container, or a hard-coded Google tag sitting on top of your GTM one. Both fire on every page, and GA4 logs each visitor twice.
Duplicate Google tag
Two GA4 tags in the same container, or one hard-coded tag plus the GTM version, double every pageview. Check the Tags list in preview and confirm only one GA4 configuration tag fires per page.
Tag stuck in preview only
A tag tested but never published sends nothing to real visitors. After preview passes, publish the container and verify the tag fires again on the live site.
Your own domain as a referral
If GA4 lists your domain as a referral, sessions split and look like two visits. Add your domain to the unwanted referrals list in GA4 admin.
Firing on the wrong pages
A trigger set to All Pages fires everywhere, including staging or thank-you pages you meant to exclude. Walk through two or three page types in preview and confirm the tags you expect.
07 / 12
How do I know the data is actually arriving?
DebugView and Realtime. Do not assume the install worked because the container published cleanly.
DebugView shows events live from your own device while preview mode is on, confirming the tag fired and GA4 accepted it. If it stays empty, the tag did not fire.
Then check Realtime without preview mode. If it stays flat, verify the measurement ID matches the property you are viewing.
-
Check the preview banner
In GTM, click Preview, load your site, and confirm the orange banner appears. A pass means the container is connected and listening.
-
Open DebugView
In GA4, go to Admin > DebugView. With preview mode active, trigger a pageview. A pass means your event appears within seconds.
-
Open Realtime
Still in GA4, open Reports > Realtime. Without preview mode, visit your site from another device. A pass means the hit shows up for the whole site.
08 / 12
What GA4 settings should I check after install?
Four settings decide whether the data is usable six months from now: data retention, internal traffic, unwanted referrals, and conversions.
GA4 keeps only a limited history of user-level data, so your retention window decides how far back you can dig when someone asks what happened last year. Changing it later does not recover what was already dropped, which is why it is the first setting to check.
Internal traffic filters keep your own team’s visits out of the reports; unwanted-referral exclusions stop payment or login domains from ending real sessions. Conversions decide what counts as a goal, and if pageview is the only event, nothing in your funnel will ever register.
Post-install settings audit
| Setting | What it controls | Usual default | Where to find it |
|---|---|---|---|
| Data retention | How long user-level data stays available for exploration | 2 months | Admin > Data collection and modification > Data retention |
| Internal traffic | Excludes your team's visits from reports | Off | Admin > Data streams > Configure tag settings > Define internal traffic |
| Unwanted referrals | Stops payment or login domains from ending real sessions | Empty list | Admin > Data streams > Configure tag settings > List unwanted referrals |
| Conversions | Marks events that count as goals | None | Admin > Events > Mark as conversion |
Check each of these after the GA4 tag is live. The defaults are the GA4 out-of-the-box values; adjust them to match your business.
Going further
About retention
Rule to know
Why retention is the first setting to touch
Data retention limits how far back you can analyze user-level data, and shortening it later permanently drops older data.
Data retention sets the maximum age of user-level data kept for explorations, like path analysis or segment overlap. The default window is short, so if you plan to analyze year-over-year behavior, raise it before you need the history. GA4 lets you choose 2 or 14 months; picking 14 months is a one-time fix that pays off when you run long-term reports.
The interaction with reporting windows is what makes retention urgent. Standard reports roll up data regardless of retention, but explorations and audience-building rely on the user-level store. Once data ages out, it is gone from those tools, and no later setting change brings it back.
- Default retentionGA4's default is 2 months; many teams leave it there.
- One-time changeYou can switch to 14 months at any point, but it only affects future data.
- Reporting impactStandard reports are not directly limited by retention; explorations and audiences are.
- Audit timingCheck retention within the first week after install before old data accumulates.
09 / 12
How do I stop the same pageview being counted twice?
Check for two GA4 tags in the same container, a hard-coded tag still in your site theme, and a tag firing on more than one trigger.
Duplicate pageviews usually come from two sources: a tag (a snippet of code that sends information somewhere, such as a pageview to GA4) that exists both in your container and on the site itself. The other is a single container holding two nearly identical tags, often from an imported template.
You don't need to guess. Open preview mode and watch which tags fire on one page load. Two identical pageview tags on the same page is the answer.
Container tags
Open your GTM container and look for two Google tags sending pageviews to the same GA4 measurement ID. A copied workspace or imported template is the usual origin. Delete the duplicate, then republish.
Hard-coded snippets
Search your site's theme or header file for a leftover gtag.js snippet. gtag.js is the older direct code you paste into your site; it only sends data to Google services. If it's still there alongside your GTM tag, every pageview is counted twice.
CMS plugins
Check your CMS plugin list for anything that injects a Google Analytics tag on its own, such as an SEO or analytics plugin. Disable that injection or point the plugin at GTM instead.
Trigger overlap
In GTM, confirm the pageview tag fires on the All Pages trigger only. A second trigger like a scroll or click trigger on the same tag will fire it again mid-session.
10 / 12
Can I do this myself or should I hire someone?
The basic install is a marketer job. The moment you need a data layer, consent handling, or server-side tagging, bring in help.
Keep it in-house for the Google tag, the All Pages trigger, preview and publish, DebugView checks, and the settings audit. Those tasks are configuration work a marketer can run in an afternoon without touching code.
Bring in help once you need a data layer (a shared place on the page where your site writes information that tags can read), e-commerce events, consent mode configuration, server-side containers, or anything that touches legal questions about user data. Remember that GTM only deploys tags while GA4 stores and reports the data, so neither replaces the other.
Do it yourself
You follow the GTM and GA4 setup steps yourself and own every tag, trigger, and setting change. Right for a team with one person who can spend a focused afternoon on tracking.
- Typical cost
- Staff time only
- Scope
- Google tag, All Pages trigger, preview, DebugView, settings audit
Key pointSet a calendar block for the install and a follow-up check one week after publish.
Hire an agency
An agency takes over the full measurement layer and usually bundles it with reporting or analytics work. Right when you need a data layer, e-commerce events, or ongoing tag maintenance.
- Typical cost
- Monthly retainer, scoped per project
- Scope
- Data layer design, e-commerce events, consent mode, reporting
Key pointAsk for a written scope that lists which tags and events they own and which stay with you.
Hire a contractor
A freelance analytics implementer fixes a specific gap and hands the container back to you. Right for a one-time job like consent mode configuration or a server-side container.
- Typical cost
- Hourly or fixed-fee, per project
- Scope
- One defined task, with admin access handed back
Key pointKeep admin rights on your GTM container and GA4 property; give the contractor edit rights only.
11 / 12
Frequently asked questions
12 / 12










