Share

What is gtag.js?

Gtag.js is a JavaScript snippet you paste directly into your site's code, usually in the header, that sends data straight to Google Analytics (and can also feed Google Ads). It's the thing GA4 hands you when you first set up a property: a short script tag with your measurement ID baked in. It's simple, it's fast to install, and for a small site that no marketing team touches, it can be enough.

The tradeoff is that every change to what gets tracked requires a code change. Want to track a new button click? Someone edits the gtag snippet or adds new JavaScript, then redeploys the site. For a service business with one or two people who understand code, that's a bottleneck. For a business with a marketing person who wants to add a new conversion event without waiting on a developer, gtag alone is the wrong tool.

What Google Tag Manager is

GTM is a layer that sits between your site and every tracking script you want to run, including gtag itself. You install one container snippet once, and after that, adding, editing, or removing tags happens inside the GTM interface, no code deploy required. GTM can fire the Google tag for GA4 (which does the same job as gtag.js), fire a Google Ads conversion tag, fire a Meta Pixel, and manage triggers and variables for all of them in one place.

Convenience is the smaller benefit. The bigger one is that GTM gives non-developers a controlled way to add tracking without touching the site's codebase, which matters for a service business where the person who understands the marketing goals and the person who can edit the site's code are rarely the same person. That's the point of it.

Work With John

If your site isn't bringing in inquiries, that's fixable.

I work with US service businesses and B2B brands on SEO, websites and lead follow-up. On a free strategy call, I'll tell you what's holding your site back, without a sales pitch.

Get a Free Audit

Should a service business use GTM or gtag?

For almost every service business past the "one-page site with no marketing activity" stage, GTM is the right call. Gtag isn't bad, but the moment you want to track more than pageviews, a phone click, a form fill, a scroll depth, a specific button, doing that through direct code edits turns every tracking change into a developer request. GTM turns most of those into a fifteen-minute task you can do yourself once you understand the container.

The exception is a simple, rarely updated site where GA4 pageview tracking is the only thing that will ever be needed. In that narrow case, a direct gtag snippet is one less system to maintain. That case rarely holds for long once a business starts running ads or wants to know which pages bring in leads. Then it needs GTM after all, and has to migrate an existing gtag setup instead of starting clean.

The migration mistake that causes duplicate data

Here's where GTM vs gtag stops being a simple choice and starts being a common source of broken numbers. When a site already has a direct gtag.js snippet installed and someone later adds GTM with its own GA4 configuration tag, both can end up sending pageview data to the same GA4 property at the same time. The result is inflated pageviews, sometimes exactly double, and a conversion rate that looks worse than it is, because the denominator is inflated.

A typical version goes like this. A business redesigns its site, and GA4 pageviews jump with no real change in traffic. The redesign added GTM for new marketing tags, but nobody removed the gtag snippet the previous developer hardcoded into the site template, so both send pageviews with the same measurement ID and every visit counts twice. The fix takes minutes: remove the hardcoded snippet and let the GTM-managed tag be the single source of truth. The harder part is that every report since the redesign now needs a footnote.

Where gtag quietly shows up even inside a GTM setup

One more wrinkle worth knowing: choosing GTM doesn't mean gtag disappears entirely from the picture. Under the hood, GTM's own GA4 tag type is built on the same gtag library, and Google Ads conversion tracking sometimes asks you to add a small gtag-based snippet directly to a site for features like enhanced conversions, which capture hashed customer data at the moment of conversion for better ad matching. That snippet can coexist with a GTM-managed setup without causing duplication, because it's typically scoped to a narrow purpose rather than sending general pageview or event data.

The distinction that matters is between gtag as a general-purpose tracking method competing with GTM, which is the scenario to avoid, and gtag as a narrow, purpose-built snippet Google Ads sometimes requires for a specific feature, which can sit alongside GTM without conflict. If a snippet Google Ads gives you looks like gtag code, don't assume it duplicates your GTM setup automatically. Check what it sends first. Then decide whether to remove it or keep it.

Duplicate GA4 tags inside GTM itself

Duplication doesn't only happen between a hardcoded gtag snippet and GTM. It also happens entirely inside GTM when two different people, at two different points in time, each add their own Google tag for GA4 because neither realized one already existed. It often happens after a rebrand, when a new agency sets up fresh tracking without auditing the container and leaves two tags firing on every page, both pointing at the same property.

The check is the same either way: open the container, filter tags by type and look at the Google tags (called GA4 Configuration tags before Google renamed them in 2023). There should be one for your GA4 measurement ID, firing on all pages, as the base that every GA4 event tag relies on. If you find two, the fix is deleting the redundant one and confirming in Preview mode that only a single configuration tag fires on a normal page load before you publish the change.

How to check if this is happening on your site

Right-click any page, view source, and search for "gtag" and "googletagmanager." If you find a direct gtag.js script tag with your measurement ID in the page's raw HTML, and you also have GTM installed with its own GA4 configuration tag pointing at the same measurement ID, you have two paths sending the same data. The check takes two minutes. The fix is always to pick one system of record, almost always GTM once it's installed, and either remove the hardcoded gtag snippet or make sure only one of them is set to fire.

This is also a good moment to open GTM's Preview mode and confirm, in real time, which tags fire on a normal page load. If you see two separate GA4-related events firing on the same pageview, that's the duplication showing up live rather than as a suspicious pattern in a report weeks later.

If you find both and would rather not untangle them yourself, my GA4 setup service starts with a check of what's installed and ends with GA4 running once, through Tag Manager.

Making the decision once and moving on

If you're setting up tracking for the first time, install GTM from the start and manage GA4 through a tag inside it rather than a hardcoded snippet, because it isn't a close call for a business planning to run ads, test landing pages or track forms and phone calls, which covers almost every service business. Save gtag-only setups for sites that will never need more than a pageview count, and even then, revisit that assumption in a year.

Getting this decision right the first time avoids the exact duplication problem above and sets up a structure that scales cleanly as tracking needs grow. Once GTM is the single system managing your tags, the next step is making sure the container itself is organized well enough that someone else could understand it without a walkthrough, which I cover in Google Tag Manager for service businesses: how to set up the container the right way. And once the plumbing is solid, it's worth auditing what runs through it. A surprising number of GTM containers accumulate the same handful of avoidable errors over time, which I break down in Google Tag Manager mistakes that quietly break your tracking data.

Where this fits with the bigger picture

None of this matters much if you're not looking at the numbers it produces, and it matters even less if search visibility and on-site tracking never get connected. My resource on how to read a Google Search Console report is a natural companion to this, since search data and on-site conversion data answer different halves of the same question: are people finding you, and once they do, are they converting. Both live in the Analytics & Data part of the site, alongside the rest of what I've written on tracking setups.

The GTM vs gtag decision itself isn't complicated once you strip away the jargon. GTM wins for almost every service business that wants control over its own tracking without a developer in the loop for every change. The complexity comes from cleaning up what happens when both get installed without anyone checking for overlap, which is worth a five minute check on any site you didn't build from scratch yourself. Do it this week.