---
title: "Configure the GTM container script and noscript"
date: 2026-05-04
author: "GTM Kit"
---

# Configure the GTM container script and noscript

This guide explains the **Container script implementation** and **Container noscript implementation** options on the General tab and when to change them.

## What these settings do

Google Tag Manager has two parts: a `<script>` block in the `<head>` and a `<noscript>` `<iframe>` right after `<body>` for users with JavaScript disabled. GTM Kit injects both for you. These two settings control *how* and *where* each part is loaded.

## Container script implementation

ModeBehaviorUse when**Default**The container loads as normal, with `async` from the `<head>`.Almost always. Recommended.**Idle**The container is loaded with `requestIdleCallback`, after the browser finishes laying out and rendering the page.You are pushing for the highest possible Core Web Vitals scores and can accept that GTM-fired tags start a fraction of a second later, after first paint.The mode value `2` was used in earlier versions and is now treated the same as `1` (Idle). Existing installs are auto-migrated on upgrade.

The trade-off: idle loading improves perceived performance and Lighthouse scores, but a tag that needs to fire on initial page render (e.g. a heatmap that captures the first scroll) may miss its window. If you do not actively need idle, leave this on Default.

## Container noscript implementation

The `<noscript>` fallback is what Google’s standard install instructions tell you to put right after the opening `<body>`. It exists so users with JavaScript disabled (and some bots and crawlers) still get an image-based pageview ping.

ModeBehaviorUse when**wp\_body\_open**The fallback fires on the `wp_body_open` action, which most modern themes call right after the opening `<body>` tag. This is the WordPress recommended location and matches Google’s official install instructions.Almost always. Recommended.**body\_footer**The fallback is moved to a `body_footer` hook (just before `</body>`).Your theme does not call `wp_body_open` and you cannot change that. The `<noscript>` is technically valid here too, just less standard.If your theme is reasonably modern, mode 0 (`wp_body_open`) is correct. Themes built before WordPress 5.2 may not call `wp_body_open`. If yours does not, mode 1 is the workaround.

## Steps

### 1. Open General settings

Go to **GTM Kit, General**.

### 2. Find Container script implementation

It is in the section that holds your container ID and container injection toggles.

### 3. Pick a mode and save

The default for new installs is **Default**. Change only if you have a specific reason.

## Verify it worked

Open your public site, view source, and look for the GTM `<script>` block. In Default mode it will be a standard `(function(w,d,s,l,i){...})` snippet inside the `<head>`. In Idle mode the surrounding wrapper uses `requestIdleCallback`.

For the noscript: look for a `<noscript>` containing `googletagmanager.com/ns.html?id=GTM-XXXXX`. In mode 0 it sits right after `<body>`. In mode 1 it sits at the end of the document just before `</body>`.

## Common issues

**Idle mode breaks first-page tags.** Switch back to Default. Idle saves a few hundred milliseconds at most. If a tag misses initial load, that cost is not worth it.

**The noscript does not appear in source.** Either container injection is off (see [Disable container injection](https://gtmkit.com/documentation/disable-container-injection/)), or your theme does not call `wp_body_open` and you are on mode 0. Switch to mode 1 (`body_footer`).

## Related articles

- [Disable container injection](https://gtmkit.com/documentation/disable-container-injection/)
- [Use a custom server-side GTM domain](https://gtmkit.com/documentation/sgtm-server-side-tracking/)
- [The container snippet is not loading](https://gtmkit.com/documentation/the-container-snippet-is-not-loading/)