---
title: "Disable container injection"
date: 2026-05-04
author: "GTM Kit"
---

# Disable container injection

This guide explains the **Inject Container Code** toggle and the **Just the data layer** mode, and when you need them.

## When to disable container injection

The default and recommended setup is: GTM Kit loads both the GTM container and the data layer. You do not need to do anything else.

Disable container injection only when something else on your site is responsible for loading the GTM container. The most common cases are:

- **Your CMP (consent management platform) loads GTM after consent.** Cookiebot, Cookie Information, Complianz, OneTrust, and similar tools sometimes manage the GTM script themselves so they can hold it back until consent is given.
- **A cache or speed plugin manages script loading.** WP Rocket and Perfmatters can be configured to inject the snippet themselves.
- **You have manually pasted the snippet into your theme** for any reason.

In all of these cases, having two sources load the same container produces double-firing. Turn off injection in GTM Kit and let the other source own it.

## What stays on when you disable injection

GTM Kit still pushes events to `window.dataLayer`. That is the whole point of GTM Kit. The plugin only stops emitting the `<script>` and `<noscript>` blocks; everything else (post data, e-commerce events, form submissions, consent defaults) continues to run.

This is sometimes called **“Just the data layer”** mode.

## Steps

### 1. Open General settings

Go to **GTM Kit, General**.

### 2. Turn off Inject Container Code

Toggle **Inject Container Code** off and save. An admin notice will remind you that GTM Kit is no longer outputting the snippet.

### 3. Confirm the other source is loading the container

Open your site in an incognito tab and view source. Search for your container ID. If it appears, the other source is doing its job. If it does not appear, you have just disabled tracking entirely.

This silent failure is the most common support pattern with this setting. If you are unsure, leave Inject Container Code on.

## Disable via constant

You can also lock the toggle off via `wp-config.php`:

```
define( 'GTMKIT_CONTAINER_ACTIVE', false );
```

When the constant is defined, the admin UI shows the value as locked and ignores changes from the settings page. Useful for staging environments or when you want to enforce the setting from infrastructure.

## Verify it worked

After saving and clearing caches, view-source your site. The `<script>` block that contains `googletagmanager.com/gtm.js?id=GTM-XXXXX` should be gone if injection is off and your CMP/cache plugin has not yet inserted its own. If you only want to verify that GTM Kit’s own injection is suppressed, the absence of the `<noscript>` fallback after `<body>` is also a good signal.

The data layer should still populate. In DevTools console:

```
window.dataLayer
```

You should still see events being pushed.

## Common issues

**Tracking stopped after disabling injection.** Nothing else is loading the container. Either re-enable Inject Container Code, or finish configuring whichever plugin is supposed to take over.

**Container loads twice (double firing).** Two sources are loading it. Disable one, usually GTM Kit.

**Admin notice complains about no GTM container detected.** GTM Kit can warn you when injection is off and no container ID is present in the rendered HTML. Treat the notice as a real problem; do not dismiss it without fixing the root cause.

## Related articles

- [Coexist with a CMP](https://gtmkit.com/documentation/coexist-with-a-cmp/)
- [The container snippet is not loading](https://gtmkit.com/documentation/the-container-snippet-is-not-loading/)
- [Conflicts with cache and consent plugins](https://gtmkit.com/documentation/conflicts-with-cache-and-consent-plugins/)