PageSpeed keeps blaming Google Tag Manager, so I looked at ~11k Shopify stores. Running both GTM and gtag.js is where it gets heavy

Every time I run PageSpeed on a Shopify store, Google Tag Manager is sitting near the top of the third party list. People keep asking me if it’s actually that bad, so I went back through the ~11k stores from my crawl and pulled it out.

It’s on about 45% of homepages. Where it runs, it eats around 280ms of phone main thread time on a typical store. A quarter of stores are over 480ms and a few percent go past a full second. Of the third parties that show up on a lot of stores, nothing else costs more per store.

The part I didn’t expect: what PageSpeed calls “Google Tag Manager” often isn’t just GTM. It lumps everything from googletagmanager.com together, so the GTM container (gtm.js) and the Google tag (gtag.js, the thing GA4 and Google Ads use) all end up on that one line. When I split them:

both: around 414ms
gtag.js only: around 168ms
GTM container only: around 100ms

So the heavy ones are mostly stores running both. Could just be that they track a lot more, I can’t prove anyone’s loading the same tag twice. But it’s the first thing I’d check, because it’s really easy to end up with GA4 through the Google channel and again inside a container someone set up years ago.

It seems to reach real shoppers too. Going by Google’s field data, stores where these scripts are light (under 100ms) pass the INP check about 75% of the time, the heavy ones (600ms+) about 61%. That’s correlation though, stores with more tracking usually have more of everything.

Quick way to check yours: view source on your homepage and search for googletagmanager.com. gtm.js?id=GTM- is a container, gtag/js?id= is a Google tag. If the same G- ID shows up in more than one place (theme.liquid, the Google channel, inside GTM) you’re probably sending it twice. Also worth clearing out old tags in the container, pause first and delete later. Just check with whoever runs your ads before you kill anything.

Couple of honest limits: homepage only, I only kept the 12 heaviest third parties per store, and I can’t see inside a container. Pixels that GTM loads get counted under their own company, so a busy container really costs more than this.

Has anyone actually cleaned this up and then seen INP move in Search Console a month later? Curious if the field data follows.

Hey @DanielBuilds,

Worth knowing before anyone judges a cleanup: the INP figure in Search Console’s Core Web Vitals report is the 75th percentile over the last 28 days, so a fix only shows in full about four weeks after it goes live, and the first couple of weeks still mix old and new visits. If you click Start Tracking (Validate fix) on the INP issue right after the change, Search Console runs its own 28-day check and marks it fixed or failed, which gives a cleaner before/after than eyeballing the chart.

Thanks, good to hear the audits line up with the crawl. The Google channel plus an old container sitting in theme.liquid is exactly the combo I’d have guessed from the numbers, nice to have it confirmed from the people actually opening these stores.

And pause for a week, then remove, is the right order. Whoever runs the ads gets nervous for good reason.

On the before/after data: if anyone does a cleanup and wants the lab side measured too, send me a DM with roughly when the change went live and I’ll rerun the homepage the same way I ran the crawl. Would be good to get a few real cases into this thread.

Hey @Daniel_Jude

Didn’t know Validate fix runs its own 28-day check, thanks. That’s a much cleaner before/after than staring at the chart and guessing where the old visits stop.

One catch for smaller stores: if there isn’t enough Chrome traffic, there’s no INP issue in Search Console to validate in the first place. In that case the Web performance report in Shopify admin still shows INP over time, so you can at least watch the trend after the change.

Hi there @DanielBuilds
And this is a great distinction: in some cases, being able to track everything is not the same as having GTM and gtag.js installed on every platform. I want to give you some best practices to use when implementing GTM on Shopify after you are done socalizing your Google & YouTube channel, theme.liquid, customer events and current GTM containers with special attention paid to duplicate GA4 or Google Ads tags. Before eliminating any of these, compare events in GA4 DebugView and test if purchase tracking is working so you don’t lose attribution. Finally reduce scripts which no longer apply, test again with PageSpeed Insights, and monitor Core Web Vitals, especially INP, over the next weeks.

Thanks @Roan. Have you come across this much in practice? I’d be curious where you usually find the extra copy—old theme code, a custom pixel, or a forgotten GTM container.

Did the crawl include any headless storefronts, or only theme stores? I’d expect a different pattern there. App pixels from Customer events don’t run on Hydrogen or other custom storefront pages, only on checkout, so GTM in the root layout is usually the only tag on the storefront and the Google channel pixel takes over at checkout. That avoids the double loading you found.

It does tend to split sessions in GA4, though, if checkout is on a different subdomain and the client ID doesn’t carry over. The upside on a custom storefront is that you control exactly when GTM loads, so holding it until after hydration or the consent check takes a few lines instead of a fight with the theme. Is most of that 280ms in GTM itself, or in the tags it pulls in?

Hey @Arslan_Shopify_Dev, the sample wasn’t restricted to theme stores, but I haven’t verified the headless group closely enough to give you a reliable Hydrogen comparison.

The 283ms is the median main-thread time for Lighthouse’s “Google Tag Manager” group where it appeared. That includes both gtm.js and gtag/js, so I can’t tell you how much was the container itself versus the tag work from that number alone.

I only measured homepages, so the storefront-to-checkout handoff wasn’t covered.