Staging and development sites

Last updated ·

GTM Kit does not load your Google Tag Manager container on a site that WordPress reports as staging, development or local. Traffic from a copy of your site would otherwise be counted alongside your real visitors, distorting your analytics and polluting your advertising audiences.

What still happens on those sites

The data layer is still built, so you can see exactly what a live site would send. Your browser console states why the container is missing. A notice on the GTM Kit dashboard explains it and links to the setting that overrides it.

How WordPress decides

WordPress reads WP_ENVIRONMENT_TYPE, usually defined in wp-config.php or set by your host. The values that suppress the container are staging, development and local. Anything else, including an undeclared site, counts as production and tracks normally.

define( 'WP_ENVIRONMENT_TYPE', 'staging' );

Measuring a test site on purpose

Turn on Load the container on staging and test sites on the container settings, or define the constant:

define( 'GTMKIT_ON', true );
define( 'GTMKIT_LOAD_ON_NON_PRODUCTION', true );

If your site looks like a copy but has not been declared

When a site’s address reads like a test or staging copy and WordPress has not been told what kind of site it is, GTM Kit points that out and links to the WordPress documentation on declaring it. That notice is a suggestion only. It never changes what GTM Kit loads, and it can be dismissed.

← Previous

Previous article

Next →

Next article