In this article

How to Add Google Tag Manager to a WordPress Site in 4 Simple Steps

Chapter 1/10 of the Zen Digital Toolkit
Added by Zen
04 Sep 2024
Google
Main Image 2

Welcome to our Zen Digital Toolkit, a place where we break things down into simple, actionable steps that you can use in your daily marketing efforts.

In this series we'll guide you with practical roadmaps that will bring calm and clarity to your marketing journey. Whether you’re working on lead generation, digital campaigns, or setting up your ads, these tips will help you stay on track.

What is Google Tag Manager (GTM) and Why Is It Important?

Google Tag Manager is a free tool that allows you to manage and deploy marketing tags (like analytics tracking, pixel codes, or other snippets) on your website without needing to alter the code manually. It simplifies the process of adding, updating, and testing tracking codes, giving you greater control over how you track visitor interactions. If you’re using a WordPress site, integrating GTM means you can optimize your data collection, enabling better insights for campaign performance and user behavior, all without needing a developer for every change.

Steps for Configuring Google Tag Manager on WordPress
Just 4 easy steps to configure GTM. Let's get started!
Step 1: Environment Setup

Before starting, make sure you are using a self-hosted WordPress site (WordPress.org) as this method won’t work on WordPress.com.

  1. Download the Google Tag Assistant Companion (Free).

  2. Sign up for Google Tag Manager (Free) and
    1. Log in using your Google account.
    2. Create a new GTM account by filling the account details:
      1. Account Name (something recognizable)
      2. Country
      3. Container Name (your website URL)
      4. Target Platform (The place where you will use Google Tag Manager e.g., website, mobile)
      5. (Optional) Check the box to share data anonymously with Google.
      6. Click Create 
    3. Accept the Terms of Service
    4. Ignore the provided code since we won’t manually add it.
  3. Welcome to your Workspace
    1. Note your Google Tag Manager ID (e.g., GTM-XXXXXX).
    2. Click Submit > Publish > Continue to publish your GTM container.
Your browser does not support the video tag.
Step 2: Install and Configure the Google Tag Manager WordPress Plugin
  1. Log in to your WordPress site.

  2. Go to Plugins > Add New.

  3. Search for "Google Tag Manager for WordPress".

  4. Install the GTM4WP plugin.
  5. Activate the plugin.

  6. Navigate to Settings > Google Tag Manager in the sidebar.

  7. Paste your Google Tag Manager ID (from Step 1) in the required field.

  8. Before actually installing the plugin, we recommend you create a backup of your site.

  9. Choose an installation option. Here, our journey parts in two ways:

    1. Off: Let the plugin figure out the right placement automatically. This is the easiest option, but there’s a small risk of display issues on your site. So make sure to visit your website and see if everything looks as it should. If it does, you can continue to Step 4.

    2. Manually Coded: If you're comfortable editing theme files, select this option. You’ll need to place the container code manually within your theme. If you choose this option, check Step 3 for further instructions. 



Step 3: Manually Adding GTM Code
  1. Copy the PHP code from the plugin. 

  2. Go to Appearance > Theme Editor. Please make sure that you are editing the Theme that you currently have installed on your site (If you are not sure, you can go to Appearance > Themes to check the name of the theme you are using). 

  3. Open the Theme Header template.

  4. Locate the <body> tag 

  5. Paste the copied PHP code directly underneath it 

  6. Click Update File to save changes.


Step 4: QA Your Installation
  1. Open your website in Chrome.

  2. Click on the Google Tag Assistant Companion icon in your browser. 

  3. Click Add domain. 

  4. Enter your website’s URL and click Connect. 

  5. Check if the Tag Assistant is connected to your site. If connected, you’ll see a confirmation popup on your site. 

That's it!

Stay tuned for more articles in our Zen Digital Toolkit series, designed to bring clarity to your marketing journey.

Remember, marketing success is about finding balance—between creativity and strategy, vision and execution.

Conclusion

Want help implementing GTM or need advice on your overall marketing strategy?

Don’t hesitate to reach out. We're here to help you simplify the complexities of digital marketing.

Copyright ©zenvertising. All rights reserved.