Website Tracking

How To Install Google Tag Manager To Your WordPress Website

Google Tag Manager (GTM) is a free tool that makes it easier to add and update tracking tags within your website. It’s recommended to use Google Tag Manager for all the tags on your WordPress website.

If you don’t have a GTM account yet, please read the article about Google Tag Manager first.

Recommended first step: installing “Insert Headers and Footers” plugin

Insert Headers and Footers is a simple plugin that lets you insert the Google Tag Manager code easily into your WordPress site header and footer.

This means there’s no need to edit your theme files and your codes will stay where they are even after you update your theme!

To install this plugin:

  1. Login to the back-end of your website (

  2. Go to Plugins > Add New and then search for “Insert Headers and Footers”. Press “Install Now” in the “Insert Headers and Footers” square.

  3. In the left hand menu, go to Plugins > Installed Plugins and then scroll down to find the “Insert Headers and Footers” plugin. Click on Activate.

Screenshot of Insert Headers and Footers WordPress plugin.

Then, add the Google Tag Manager script to your WordPress site

Next we can install the GTM code on your site:

  1. Login to the back-end of your website (

  2. In the left hand menu, go to Settings > Insert Headers and Footers

  3. Replace GTM-XXXXXXXX for the code below with your GTM container ID. You can find this by logging into GTM. Copy and paste the code below into the Scripts in Header” section.

<!-- Google Tag Manager -->


new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],




<!-- End Google Tag Manager -->

  1. Then in the “Scripts in Footer” sector copy+paste the code below and press save.

<noscript><iframe src="'GTM-XXXXXXX'"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

Click save, en voilà: Google Tag Manager is live on your site.



Jeroen Minks

With over 10 years experience in digital marketing, Jeroen helps businesses to get more results out of their online advertising budgets.