how to add google tag manager to wordpress
How To

How to Add Google Tag Manager to WordPress?

Author: Brian Denim


Last Updated: July 7th, 2023

Are you a WordPress user looking to add Google Tag Manager to WordPress website? Google Tag Manager is a powerful tool that allows you to manage and deploy various tracking codes, analytics scripts, and marketing tags without modifying your website’s code. In this article, we will guide you through the process of adding Google Tag Manager to your WordPress website, step by step.

What is Google Tag Manager?

Google Tag Manager (GTM) is a free tool provided by Google that simplifies the process of managing and deploying various tags on your website. Tags are snippets of code that collect data and send it to third-party services like Google Analytics, Facebook Pixel, or AdWords. By using GTM, you can add, edit, and disable tags without having to modify your website’s code directly.

Setting Up a Google Tag Manager Account

add google tag manager to wordpress

To get started, you need to add a Google Tag Manager account. Follow these steps:

  • Go to the Google Tag Manager website and sign in with your Google account.
  • Click on the “Create Account” button.
  • Fill in your account name and select your country.
  • Accept the terms of service and click “Yes” to agree to the data processing terms.
  • Click on the “Create” button to create your account.

Firstly, Creating a Google Tag Manager Container

After setting up your account, you need to create a container. The container holds all the tags, triggers, and variables for a specific website. Here’s how you can create a container:

  • Click on the “Create Container” button.
  • Enter the name of your container. This can be the name of your website or any descriptive name.
  • Select the container platform. In this case, choose “Web.”
  • Choose the target platform. Select “Web” again.
  • Click on the “Create” button to create your container.

Let’s See How to Add Google Tag Manager to WordPress

Using the best google tag manager plugin for WordPress, After you have created your container, you must deploy the Google Tag Manager code on your WordPress website. Follow these steps:

  • Copy the generated GTM container code from the Google Tag Manager interface.
  • Log in to your WordPress dashboard.
  • Install and activate a suitable GTM plugin. There are several options available, such as “DuracellTomi’s Google Tag Manager for WordPress” or “PixelYourSite.”
  • Go to the plugin settings and paste the GTM container code into the appropriate field.
  • Save the changes.

If you want to add google tag manager to WordPress without using WordPress Plugin. You have to add it manually & have a common question – where to put the Google tag manager code? All you have to do is – Put it in the <head> of your HTML output, preferably as near to the opening <head> tag as feasible but below any data-layer declarations.

Verifying Your Google Tag Manager Installation

After installing the GTM code, it’s important to verify if it’s working correctly. Here’s how you can do it:

  • Go back to the Google Tag Manager interface and click on “Verify your installation.”
  • Follow the instructions provided to verify your installation.
  • Once the verification is successful, you will see a confirmation message.

Adding Tags and Triggers

Now that you have Google Tag Manager set up on your WordPress website, you can start adding tags and triggers. Tags are snippets of code that perform specific actions, and triggers define when and where tags should be fired. Follow these steps to add tags and triggers in Google Tag Manager:

  • Log in to your Google Tag Manager account.
  • Select the container for your WordPress website.
  • Click on “Tags” in the left sidebar.
  • Click on the “New” button to create a new tag.
  • Give your tag a descriptive name.
  • Select the tag type based on your requirements. For example, if you want to add Google Analytics tracking, choose the “Google Analytics – Universal Analytics” tag type.
  • Configure the tag settings according to your needs. This may include providing your Google Analytics tracking ID or customizing other options.
  • Define the trigger for your tag. Triggers determine when and where the tag should be fired. You can choose from pre-defined triggers or create custom triggers based on specific events, URLs, or other criteria.
  • Save your tag.

Repeat these steps to add additional tags and triggers as needed for your website.

Testing and Publishing

Before making your changes live, it’s essential to test your Google Tag Manager setup. This ensures that the tags are firing correctly and sending the desired data to your third-party services. Here’s how you can test your setup:

  • In Google Tag Manager, click on “Preview” in the top right corner.
  • Open a new tab and visit your WordPress website.
  • Perform actions on your website that trigger the tags you have set up.
  • In the Google Tag Manager preview panel, you can see which tags are firing and check for any errors.
  • Once you are satisfied with the testing, click on “Submit” in the top right corner of Google Tag Manager to publish your changes.

Advantages of Using Google Tag Manager

Google Tag Manager offers several benefits for WordPress users:

  • Simplified tag management: With Google Tag Manager, you can easily add, edit, and disable tags without touching your website’s code.
  • Faster implementation: Implementing tracking codes and marketing tags becomes quicker and more efficient, saving you time and effort.
  • Centralized control: You have centralized control over all your tags, triggers, and variables, making it easier to manage multiple tags on your website.
  • Flexibility and scalability: Google Tag Manager allows you to add a wide range of tags, including analytics, conversion tracking, remarketing, and more, without the need for developer intervention.
  • Data accuracy: By implementing tags through Google Tag Manager, you reduce the risk of code errors and ensure accurate data collection for your analytics and marketing campaigns.

Bottom lines,

Adding Google Tag Manager to your WordPress website can greatly simplify the process of managing and deploying tracking codes and marketing tags. By following the steps outlined in this article, you can seamlessly integrate Google Tag Manager and take advantage of its benefits for efficient tag management.

Frequently Raised Queries:

1. Can I add Google Tag Manager to any WordPress theme?
Yes, Google Tag Manager can be used with any WordPress theme. It operates independently of the theme you choose.

2. Do I need coding skills to use Google Tag Manager?
No, Google Tag Manager is designed to be user-friendly, and you don’t need coding skills to implement and manage tags.

3. Can I add multiple containers to a single WordPress website?
It is recommended to use a single container for each website. However, in certain cases, you can add multiple containers if needed.

4. What happens if I uninstall the Google Tag Manager plugin from my WordPress site?
If you uninstall the plugin, the GTM container code will be removed from your website, and the tags managed through GTM will stop working.

5. Are there any limitations to the number of tags I can add in Google Tag Manager?
Google Tag Manager has generous limits for the number of tags, triggers, and variables you can add. It is designed to handle a large number of configurations, so you can add as many tags as necessary for your website.

Read other useful articles to get more insights:

Brian Denim
facebook icon linkedin icon

Brian Denim

Brian Denim is a WordPress expert and tech enthusiast. He helps others optimize and enhance their WordPress websites through writing, speaking engagements, and consulting. Brian is dedicated to sharing his knowledge and helping others achieve their online goals.

Subscribe Newsletter

Fill in your email address to subscribe to this blog and start receiving email updates of WordPress tips, news and new content.