Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GTM snippet in the footer firing late: how to find and fix it

TRK-105Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

Google Tag Manager (GTM) gives you two pieces of code. The main script belongs as high as possible in the <head>. The noscript iframe belongs right after the opening <body> tag. This issue is when the main script has been pasted into the footer, often because a theme, page builder or plugin only offered a footer box.

Why it costs you leads or sales

Late loading creates a window where visitors act but GTM is not there yet. Events in that window are lost, and the ad platforms never hear about them.

What happens when GTM loads last
  1. Page starts loadingHead and body content render first
  2. Visitor clicks or submitsHappens before the footer is reached
  3. GTM loads lateContainer arrives after the action
  4. Tags fireListeners missing, event never seen
  5. Conversion reportedGA4 and ad platforms get nothing

The visitor acts before the footer script has loaded, so the conversion is never reported.

Typical effects: the first page view is missed or recorded after the user left, click triggers on buttons that were pressed early do nothing, and a redirect or quick bounce ends the visit before any tag runs. Slow connections make it worse because the footer script waits behind images and other scripts. Under-reporting makes campaigns look worse than they are and starves ad bidding of conversion data.

Share of visits where the page view tag firesExample numbers
Share of visits where the page view tag fires (example)Head, fast connection: 99 %; Footer, fast connection: 96 %; Footer, slow mobile: 85 %03876999685Head, fast connectionFooter, fast connecti…Footer, slow mobile%

Example: illustrative numbers showing how a late snippet can lose more visits on slow connections.

How to check if your site has it

Find where the snippet sits
  1. View the page source

    Open your page, right-click, choose View page source and search for googletagmanager.com/gtm.js. Note whether it appears inside <head> near the top or far down near </body>.

  2. Check the order in the Network tab

    Open DevTools, go to Network, reload and filter for gtm.js. If it starts after your images and theme scripts, it is loading late.

  3. Use Tag Assistant

    Open tagassistant.google.com, connect your site and look at the event order. A late Container Loaded or a Page View that arrives long after the page rendered points to this issue.

  4. Check the noscript part

    Search the source for ns.html?id=GTM-. It should sit directly after the opening <body> tag.

How to fix it

The goal is the standard placement from Google. Remove the footer copy first, so you do not end up with two containers loading and counting events twice.

Main GTM script: as high in the head as possiblehtml
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->
Noscript part: right after the opening body taghtml
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Move the snippet by platform
  1. Remove the footer copy

    Check the theme's footer scripts box, any header and footer plugin set to footer, and footer.php if you edited it.

  2. Add it to the head

    Use a GTM plugin or a header scripts plugin set to Header, or add the code in a child theme's functions.php with the wp_head hook. Use wp_body_open for the noscript part if your theme supports it.

Snippet placement

Footer

  • Script sits just before </body>
  • Container loads after content and other scripts
  • Fast clicks and early page views missed

Head

  • Script near the top of <head>
  • Container starts loading early and async
  • Noscript right after <body>

How to confirm it's fixed

Verification
  • View source shows gtm.js inside <head>, near the top
  • The ns.html iframe appears right after <body>
  • The container ID appears only once on the page
  • Tag Assistant shows Container Loaded before the page view tags
  • In GTM Preview, tags that use Page View or Initialization triggers fire on first load
  • Test conversions appear in GA4 DebugView or the ad platform's test tool

How to prevent it happening again

Placement often changes when someone swaps a theme, installs a plugin or rebuilds a template. Keep the GTM code in one documented place, such as the base layout, and note it in your launch checklist. After any theme or plugin change, view the source and search for the container ID. Give only one person or tool ownership of the snippet, so no one adds a second copy.

How FunnelGuard handles this

FunnelGuard does not check snippet placement yet. It is a possible future check. Today, a FunnelGuard robot visitor runs your real journeys on a schedule and checks that the tracking hits to GA4, Google Ads, Meta and other platforms actually arrive, so a late or missing GTM load that loses conversions can show up as a missing hit, but it will not tell you the cause is the footer position.

To watch for this yourself, view the page source after every theme, plugin or template change and confirm the container sits in the head. You can also re-run Tag Assistant on your key pages now and then, and compare GA4 conversions against form or order counts in your own system. A free read-only website audit is also available from FunnelGuard.

Questions people ask

Can I put the Google Tag Manager code in the footer?

It works, but Google recommends the main script as high in the head as possible. In the footer it loads after most of the page, so quick clicks, early page views and fast exits can be missed. Move it to the head when your platform allows.

Why is my GTM firing late?

The most common cause is the snippet sitting in the footer or being injected by a plugin after other scripts. Heavy pages and slow connections make the delay longer. Check where gtm.js appears in the page source and in the Network tab.

Where exactly should the GTM noscript go?

Place the noscript iframe immediately after the opening body tag. It is a fallback for visitors with JavaScript disabled. Putting it in the head is a different issue, as iframes are not valid there.

Will moving GTM to the head fix missing conversions?

It fixes conversions lost because GTM loaded too late. It will not fix wrong triggers, paused tags, consent blocking or a wrong container ID. Test in Preview mode after the move to see which tags now fire.

How do I check where my GTM snippet is placed?

View the page source and search for googletagmanager.com/gtm.js, then see whether it sits inside the head near the top. You can also use the Network tab in browser DevTools to see when gtm.js starts loading.

Does the GTM footer placement slow down my site?

Not really. The snippet loads asynchronously either way. The head placement lets the container start downloading earlier without blocking rendering, so it is mainly a tracking accuracy matter, not a speed one.

Can I use a tag manager plugin instead of editing code?

Yes on platforms like WordPress, where a plugin can output the snippet in the head and body. Check its settings for a footer option and make sure only one method adds the container.

Does FunnelGuard detect a GTM snippet in the footer?

Not yet. It is a possible future check. FunnelGuard does run your real journeys and check tracking hits arrive, which helps you notice lost conversions, but placement itself you check in page source.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.