Quick Guide: Installing Google Tag Manager in WordPress

If you want to optimize the monitoring and analysis of your website, Google Tag Manager (GTM) is an essential tool. This platform allows you to manage marketing tags without having to directly modify the code of your site. Here is a quick guide to install Google Tag Manager on WordPress.

What is Google Tag Manager?

Google Tag Manager is a tag management system that allows users to implement and manage tracking and marketing tags on their website without advanced technical knowledge. This includes tools such as Google Analytics, Facebook Pixel and other third-party services.

One of the main advantages of GTM is that it facilitates the organization and control of tags, which can result in better management of your marketing campaigns.

Steps to configure Google Tag Manager in WordPress

Create a Google Tag Manager account

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

  • Visit the website of Google Tag Manager.
  • Click on "Start for free".
  • Sign in with your Google account.
  • Enter your account name and select the country.
  • Configure the container, choose "Web" as the platform and click "Create".
  • Accept the terms of service.

2. Obtain GTM code

Once the account is created, you will need to obtain the GTM tracking code. This code is composed of two fragments:

// Google Tag Manager code snippet for the section.
(function(w,d,s,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:''';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.		
Quick Guide: Installing Google Tag Manager in WordPress
Download our web maintenance guide Free of charge!
Free guide for freelancers and small businesses that want to avoid surprises and improve their web performance.
js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','TU_ID_GTM'); // Google Tag Manager code snippet for the section.

Replaces TU_ID_GTM with the ID of your container, which you will find in the GTM interface.

Integrating Google Tag Manager in WordPress

Now that you have the code, it's time to integrate it into your WordPress site. You have two options: do it manually or use a plugin.

Option 1: Manual integration

To add the code manually, follow these steps:

  • Log in to the WordPress administration panel.
  • Go to "Appearance" and then to "Theme Editor".
  • Open the file header.php tag and paste the first code snippet just before the .
  • Then, open the file footer.php tag and paste the second code snippet right after the .

Remember to save the changes in both files.

Option 2: Use a plugin

If you prefer a simpler option, you can use a plugin. Some of the most recommended ones are:

  • DuracellTomi's Google Tag Manager for WordPress
  • WP Google Tag Manager

Install the plugin from the WordPress repository, activate the plugin and follow the instructions to add your GTM ID. This avoids the need to modify the code directly.

Verify GTM implementation

After integrating Google Tag Manager, it is essential to verify that everything is working properly. To do this, you can use the GTM preview tool:

  • In your GTM account, click on "Preview".
  • Enter your website URL and click "Connect".
  • Visit your site and check that the tags are being activated correctly.

Configure tags in Google Tag Manager

Once GTM is up and running, you can start configuring tags. To create a new tag, follow these steps:

  • In the GTM interface, click on "Tags" and then "New".
  • Select the type of tag you want to implement, such as Google Analytics.
  • Configure the activation parameters and conditions.
  • Save and publish the changes.

Remember that you can create multiple tags for different purposes and manage their activation according to the needs of your marketing strategy.

Conclusions about Google Tag Manager

Integrating Google Tag Manager into your WordPress site will allow you to manage and optimize your tracking tools efficiently. With proper configuration and verification, you will be on your way to improving the performance of your online marketing campaigns.