To add Google Tag Manager to WordPress, just follow these steps to get started.
First of all, you need to visit the Google Tag Manager website and then click the Sign-Up button.
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.
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.
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.
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.
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.
There’re two code snippets to be added to the header (inside <head > tag) and in the <body > section on your website.
Login to your WordPress dashboard and then install Insert Header and Footers plugin. Upon activation, go to Settings » Insert Headers and Footers page.
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.
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.
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.
Click on the ‘New Tag’ icon, and follow the steps to create your first tag.
Last updated May 24, 2022
Applies to: Other