Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To install Google Tag Manager (GTM) in WordPress, create a GTM account and web container, place the container’s two snippets in your site’s <head> and immediately after <body>, then test in Tag Assistant before publishing. Do not confuse a GTM container ID beginning with GTM with a Google Analytics measurement ID beginning with G- or a Google Ads ID beginning with AW-; those are different setup paths.

First decide whether you need GTM or a Google tag

Google Tag Manager is a container system. You install one container on the site, then use its GTM workspace to add and manage tags, triggers and variables.

A Google tag for Analytics or Ads is a separate product setup. Google’s WordPress guidance covers Google tags associated with Analytics and Ads, while GTM uses a container ID that starts with GTM. A G- measurement ID is not a GTM container ID, and following Google-tag instructions will not automatically install a GTM container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Goal Identifier to expect Correct installation approach
Install a GTM web container and manage multiple tags GTM... Use the GTM web-container snippets and then configure tags in Tag Manager.
Set up Google Analytics through a Google tag G-... Use the Google tag setup for Analytics, such as the documented Site Kit or WordPress Editor route.
Set up Google Ads through a Google tag AW-... Use the Google Ads tag instructions and verify that the tag ID matches your Ads account.

What you need before installing

  • A Google Tag Manager account and a Web container. Google’s installation guidance states that you must create both.
  • The correct GTM container ID, copied from the container you intend to use.
  • Access to the WordPress implementation. Manual installation requires access to the site template or another integration that can insert both snippets.
  • A publicly accessible site when using the documented Site Kit setup flow. Plugin, theme and hosting permissions can vary, so your WordPress dashboard may not show exactly the same controls.

Choose an installation route

Use a WordPress integration when it supports your exact setup

Google identifies Site Kit as its official WordPress plugin and lists Site Kit, MonsterInsights, WooCommerce and WordPress Editor among its platform guidance paths. These options are not interchangeable GTM-container installers. Before activating one, confirm that its instructions explicitly support the product you are installing and the ID type you have.

An integration can insert code without editing every template file, but it may require permission to install and activate plugins. If your account cannot install plugins, Google directs users to its WordPress Editor instructions for the relevant Google-tag setup.

Install the GTM container manually

Manual installation is the appropriate route when you specifically need a GTM web container and no compatible integration is handling it. It gives you direct control over placement, but you need access to the WordPress code that outputs the page head and body.

Install the GTM web-container snippets

  1. Open the correct container. Sign in to Google Tag Manager, select the account and the WordPress site’s Web container, and open its installation dialog. Copy the snippets shown there; replace any sample ID with your own GTM... container ID.
  2. Place the script in the head. Add the first snippet as high as possible inside the page’s <head> element. It must be present on the pages where the container is expected to run.
  3. Place the noscript block after body opens. Add the second snippet, the noscript iframe, immediately after the opening <body> tag. Do not put it in the head or at an arbitrary footer location.
  4. Save and deploy the WordPress change. The exact file or integration varies by theme and host. Keep a backup or use your host’s staging workflow before changing template code.
  5. Check for duplicate insertion. If a plugin or integration already installed this container, do not add a second copy manually unless that integration’s instructions specifically require it. Duplicate code can make testing and event counts difficult to interpret.

Test the installation before publishing GTM changes

Use the installation dialog’s site test

Enter the site URL in GTM’s installation or testing workflow. Confirm that the container can connect and that the expected pages load the snippets.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Tag Assistant Preview

  1. In the GTM workspace, choose Preview to launch Tag Assistant.
  2. Enter the site URL and connect it to the preview session.
  3. Browse the pages and actions that should trigger your tags.
  4. Check that the container loads, the intended tags fire, and unwanted tags do not fire.
  5. Investigate connection, consent, trigger or duplicate-container warnings before releasing the changes.

Preview mode is a test of the current workspace. Saving a change does not make it live for visitors.

Publish the verified container version

  1. Return to the GTM workspace after preview testing.
  2. Review the workspace changes and submit them as a new version.
  3. Publish the version only after the expected tags and triggers have passed your tests.
  4. Recheck the live site, because the published version—not an unsubmitted workspace draft—is what visitors receive.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

WordPress-specific maintenance and failure points

A theme change can remove manual edits

Google’s WordPress Editor procedure places a Google tag in header.php and warns that changing themes can overwrite that file. If you used that manual method, repeat the installation after a theme change and test again. This warning applies to that theme-file method; it is not a claim that every plugin or integration behaves the same way.

The wrong identifier was pasted

Reopen the GTM container and compare the installed value with the container ID shown in Tag Manager. A G- or AW- value belongs to a Google tag setup, not the GTM container snippets.

Only one snippet was added

The standard web-container installation has two pieces: the head script and the noscript iframe after the opening body tag. Recheck both locations on the rendered site, not only in the WordPress editor.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The container appears twice

Look for both a plugin/integration insertion and a manual theme insertion. Remove the unintended copy, then start a fresh Tag Assistant Preview session so results are not mixed with the earlier duplicate setup.

You cannot edit the required code

Ask the site administrator or host for the needed WordPress permissions, or use a supported integration that can install the intended product. Managed hosting, roles, themes and page builders can impose restrictions that Google’s general instructions do not resolve for every site.

Final checklist

  • You created a GTM account and selected a Web container.
  • You used the container’s own GTM... ID.
  • The script is as high as possible in <head>.
  • The noscript iframe is immediately after <body>.
  • No integration and manual edit are unintentionally installing the container twice.
  • Tag Assistant Preview shows the expected tags and triggers.
  • You submitted and published the tested version.
  • You know whether a future theme change could overwrite your manual edit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.