---
title: "The container snippet is not loading"
date: 2026-05-04
author: "GTM Kit"
---

# The container snippet is not loading

If you cannot find your GTM container in your site’s HTML source, work through this checklist.

## Symptoms

- View source on your public site does not contain `googletagmanager.com/gtm.js` or your `GTM-XXXXXXX` ID.
- GTM Tag Assistant fails to connect, or says “no GTM container found.”
- `window.dataLayer` is undefined in DevTools.

## Cause: most common to least common

1. Container injection is disabled and nothing else is loading the container.
2. A cache plugin is serving a cached page from before you saved the container ID.
3. The container ID is empty or invalid.
4. You are excluded by user role.
5. A theme with non-standard `<head>` rendering is stripping the script.

## Solution

### 1. Check the container ID

Go to **GTM Kit, General**. Confirm the **GTM Container ID** field has a valid value matching `GTM-XXXXXXX`. If empty, paste your ID and save. If you do not have one yet, see [Find your GTM container ID](https://gtmkit.com/documentation/find-your-gtm-container-id/).

### 2. Check Inject Container Code

On the same page, confirm **Inject Container Code** is on. If off, GTM Kit is intentionally not emitting the snippet. Either turn it on, or confirm that whatever else was supposed to load the container (a CMP, a cache plugin, or a manual paste in your theme) is actually doing so. See [Disable container injection](https://gtmkit.com/documentation/disable-container-injection/).

### 3. Clear all caches

The most common silent failure: you saved the GTM ID, but a page cache (WP Rocket, W3TC, LiteSpeed Cache, hosting-level cache) is still serving HTML from before the save.

- WP Rocket: **Settings, WP Rocket, Cache, Clear Cache**.
- W3 Total Cache: **Performance, Dashboard, empty all caches**.
- LiteSpeed: **LiteSpeed Cache, Toolbox, Purge All**.
- Cloudflare: **Caching, Configuration, Purge Everything**.
- Hosting-level: contact your host or check their dashboard for a cache toggle.

After clearing caches, view the public site in an incognito window.

### 4. Check user role exclusion

If the page renders the container correctly in incognito but not when signed in, you are excluded by role. See [Exclude logged-in users from tracking](https://gtmkit.com/documentation/exclude-logged-in-users-from-tracking/).

### 5. Check the constant override

If your site or hosting infrastructure defines `GTMKIT_CONTAINER_ACTIVE` or `GTMKIT_CONTAINER_ID` in `wp-config.php` or `mu-plugins`, the constant value wins over the admin UI. Search your codebase:

```
grep -r "GTMKIT_CONTAINER" wp-config.php wp-content/mu-plugins/ wp-content/plugins/
```

If a constant is set to `false` or empty, that is your problem.

### 6. Check your theme’s `<head>` rendering

GTM Kit hooks `wp_head` to emit the container script. Themes that bypass `wp_head` (rare, mostly old or extremely custom themes) will strip the script. Verify your theme calls `wp_head()`:

```
grep -r "wp_head" wp-content/themes/your-active-theme/
```

If `wp_head()` is missing from the theme’s `header.php`, the theme is broken regardless of GTM Kit. Add `<?php wp_head(); ?>` inside `<head>`.

Also check that the theme calls `wp_body_open()` right after `<body>` if you want the noscript to land in the recommended location. See [Configure the GTM container script and noscript](https://gtmkit.com/documentation/configure-the-gtm-container-script-and-noscript/).

### 7. Check for plugins that strip scripts

Some “minify” or “performance” plugins strip inline scripts they do not recognize. Common offenders:

- Autoptimize with aggressive JS optimization (try disabling **Aggregate JS Files** or excluding GTM Kit’s scripts).
- Async JavaScript with deferred inline scripts.
- Some CSP-enforcing plugins that strip scripts without a nonce.

Disable each in turn and reload. If disabling one fixes the snippet, configure that plugin to leave GTM Kit’s scripts alone.

### 8. Check the browser is not lying

Some ad blockers and privacy extensions (uBlock Origin, Privacy Badger, Ghostery) hide GTM scripts in DevTools. Test in an incognito window with all extensions disabled, or in a different browser.

## Verify the fix

After each step:

1. Open the site in an incognito window.
2. View source (Cmd or Ctrl + U).
3. Search for `GTM-` followed by your container ID suffix.

You should find at least one match in the `<head>` and one in the body (the noscript fallback). If both are present, the snippet is loading.

## When to escalate

If the snippet is still missing after every step, share the following with support:

- A view-source dump of one affected page, including the `<head>` and the first 200 lines of `<body>`.
- Your active theme name and version.
- A list of active plugins.
- Whether `GTMKIT_CONTAINER_ACTIVE` or `GTMKIT_CONTAINER_ID` is defined in your environment.

## Related articles

- [Verify GTM is firing on your site](https://gtmkit.com/documentation/verify-gtm-is-firing-on-your-site/)
- [Disable container injection](https://gtmkit.com/documentation/disable-container-injection/)
- [Conflicts with cache and consent plugins](https://gtmkit.com/documentation/conflicts-with-cache-and-consent-plugins/)