How to Install Google Tag Manager in WordPress?

To add Google Tag Manager to WordPress, just follow these steps to get started.

Step 1: Create Your Google Tag Manager Account

First of all, you need to visit the Google Tag Manager website and then click the Sign-Up button.


Sign Up for Google Tag Manager

Next, you need to sign in with your Google account. Once done, you can see the Google Tag Manager’s Create Account page. Click on the ‘Create Account’ button to get started.


Create Google Tag Manager Account

On the next screen, you can add a new account. Enter your account name and choose a country in the Account Setup box. You can use your company name as your account name.


Add New Google Tag Manager Account - Account Setup

Next, you need to set up your container. A container is the collection of tags, triggers, and all configurations installed on a website.

You can enter your website name as your container name. Choose ‘Web’ under the Where to use container option, and then click on the Create button.


Google Tag Manager Container Setup

Now you’ll need to accept the Google Tag Manager Terms of Service Agreement to proceed. Check the box next to ‘I accept the Data Processing Terms as required by GDPR.’ at the bottom, and then click the ‘Yes’ button on the top right corner.

If you want to learn more about GDPR, go through our guide on GDPR and Google Analytics.


Accept Google Tag Manager Terms of Service and GDPR terms

Upon accepting the terms of service, you’ll see a new popup window appear on the screen with code snippets to install Google Tag Manager on your website.


Google Tag Manager Installation Codes

There’re two code snippets to be added to the header (inside <head > tag) and in the <body > section on your website.

Step 2: Adding Google Tag Manager Code to WordPress

Login to your WordPress dashboard and then install Insert Header and Footers plugin. Upon activation, go to Settings » Insert Headers and Footers page.


Insert Headers and Footers WordPress Plugjn Settings

Now you can see two boxes for adding header and footer code. Go back to your Google Tag Manager account and copy the code in the first box. Paste the code into the ‘Scripts in Header’ box.

Similarly, copy the other code from your Tag Manager account and insert that into the ‘Scripts in Footer’ box. The section will print scripts before the closing </body> tag.

While it’s not right after the opening body tag (as Google suggests), as long as the snippet is enclosed within the <body>…</body> tag, it will be fine.


Add Google Tag Manager Codes to WordPress with Insert Headers and Footers plugin

After that, don’t forget to save your changes.

That’s it! You’ve successfully installed Google Tag Manager on your WordPress site. Now you can use your Google Tag Manager dashboard to install any tracking code to your WordPress website.

Step 3: Add and Publish Tags in Your Tag Manager

Once you’ve installed Google Tag Manager on your website, you’re ready to add code snippets (tags) provided by different tracking tools on your site.

Google Tag Manager supports over 50 tag types, including Google marketing products and other third-party services. Plus, you can also add custom HTML or JavaScript tags to your site using its interface.

Click on the ‘New Tag’ icon, and follow the steps to create your first tag.


Click New Tag Option to Add a New Code in Google Tag Manager


  • Was this reply helpful?
  • Yes
  • No