How to Add Google Tag Manager to WordPress for Tracking Analytics

Google Tag Manager Wordpress Featured Image

Do you want to track your WordPress website’s conversions, analytics, marketing, and other metrics? Learn how to set up Google Tag Manager (GTM) for WordPress with GTM4WP.

Good to know: are you more interested in tracking your social media analytics? We have a list of useful tools for that.

How to Add Google Tag Manager to WordPress

Before you can install Google Tag Manager (GTM) to your WordPress website, you need to create an account on the GTM page.

Follow these steps:

  1. Go to the Google Tag Manager page.
  2. Click on “Create Account.”
Google Tag Manager Home
  1. Fill out the fields under “Account Name” and “Country” in the Add a New Account screen.
Google Tag Manager Account Setup
  1. Type your website URL in this format: “www.mywebsite.com,” on the Container Setup page under “Container name,” then check your target platforms.
Google Tag Manager Container Setup
  1. Click “Create.”
Google Tag Manager Create
  1. Read the Google Tag Manager Terms of Service Agreement, and click “Yes” to finish creating your account.
  1. You’ll land on the Workspace page with a pop-up window that has sets of code hovering over the page.

FYI: check out the best wordPress plugins to integrate Bitcoins to your site.

Install the GTM4WP WordPress Plugin

Now that you have a GTM account, it’s time to set up a free WordPress plugin: GTM4WP. It will place the GTM container code to your WordPress website for you. Take these steps to install the plugin:

  1. Log in to WordPress. The account you’ll log in with should have the administrator role.
  2. From the menu on the left, hover over “Plugins,” then click on “Add New.”
Wordpress Menu
  1. On the Add Plugins screen, search for “GTM4WP.”
  2. Click on “Install Now” beside GTM4WP.
Wordpress Add Plugins Search
  1. Click “Activate” to be taken to the Plugins screen.
Wordpress Gtm4wp Activate

Tip: communicate with your website visitors by adding a WhatsApp chatbox to your WordPress site.

Copy Tracking Code From Google Tag Manager

After installing and activating the GTM4WP WordPress plugin, copy the code from the GTM page by following this step-by-step:

  1. On the Google Tag Manager account page, click on the container ID or Google Tag Manager ID.
Google Tag Manager Account Id
  1. On the Install Google Tag Manager pop-up window, there are two sets of container code that you need to set up GTM4WP in WordPress.
Google Tag Manager Code
  1. Save the container codes and Google Tag Manager ID. You can also leave this Google Tag Manager tab open before going back to WordPress.

Paste Tracking Code in WordPress

Paste the container codes from Google Tag Manager by following these steps:

  1. In the menu on the left of WordPress, hover over “Plugins,” then click “Installed Plugins.”
Wordpress Menu Plugins Installed Plugins
  1. From your list of installed plugins, find “GTM4WP,” then click on “Settings” underneath it.
Wordpress Installed Plugins GTM4WP Settings
  1. Under the General tab on the Google Tag Manager for WordPress options screen, paste your container ID or Google Tag Manager ID, formatted as “GTM-XXXXXX,” to the Google Tag Manager ID field.
Wordpress Gtm4wp Options Gtm Id
  1. Set “Container code ON/OFF to “On.”
Wordpress Gtm4wp Container Code On
  1. Select a Container code compatibility mode option.
  • Off: allows GTM4WP to decide where the second GTM container code is placed. Select this if you’ll verify your website in Google Search Console.
  • Footer: select this if you want GTM4WP to place the second code on the footer of your web pages. Note that this prevents Google Search Console verification from working.
  • Manually coded: if you want to manually paste and tweak the container codes yourself, select this option.
Wordpress Gtm4wp Container Code Options
  1. Click “Save Changes.”
Wordpress Gtm4wp General Save

WordPress alternatives: Thinking of trying other content management systems? Check out the best WordPress alternatives.

Frequently Asked Questions

Are there other WordPress plugins for Google Tag Manager?

Aside from GTM4WP, you can also use these free WordPress plugins for Google Tag Manager:

How do I know if my GTM is working?

Click “Preview” next to your container ID/Google Tag Manager ID in the Google Tag Manager account page. This will open a new tab for Google’s Tag Assistant. Enter your website’s URL, like the sample URL format, then click “Connect.” If the Tag Assistant says connected, you’re all set.

Do I need Google Analytics if I use Google Tag Manager?

No. You also don’t need Google Tag Manager to use Google Analytics. However, you can set up Google Analytics and Google Tag Manager and use them both. If you decide to use Google Analytics, check out these Google Analytics apps for Android.

Image credit: Pixabay All screenshots by Natalie dela Vega.

Is this post useful?
Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Natalie dela Vega
Natalie dela Vega - Staff Writer

Natalie is a writer specializing in tech how-tos and gaming. When she's not writing, she plays PC games and travels. Here at MakeTechEasier, you will see her write about guides, tips, and solutions for Windows and iOS.