Setting up Google Tag Manager for WordPress isn’t a complicated thing to do, but there’re multiple things to consider, and the chances of things going awry are higher. However, the good news is that not every site owner needs to set up Google Tag Manager. If you indeed want to set it up on your WordPress website, then let us look into the benefits and step-by-step way of getting it done.
Google Tag Manager
Online marketers and website owners are compelled to add code snippets from different sources to gather analytical data and track traffic and conversion. Google Tag Manager facilitates the deployment and management of multiple scripts from a standard dashboard. The in-built tag templates for Adwords, Google Analytics, DoubleClick, etc., make it easier for website owners. Tag Manager is compatible with 3rd party analytics as well as tracking platforms.
Additionally, you can even use custom HTML for adding customized tracking or code snippets to gather data as per your preferences. Thus, you save a lot of time and effort, which would have gone into adding and removing tags from the codes. Instead, you can manage every from a standard dashboard, which comprises only a single script with all the other scripts.
In this blog post, we shall look at how to add Google Tag Manager and learn to add Google Analytics using the Tag Manager. However, you must keep in mind that this article is useful only if you’re using a self-hosted WordPress site.
Here’s how to get it done in quick and easy steps:
Create a Google Analytics account for the WordPress website, and you can do that by following several YouTube tutorials. Once you get the tracking code, you don’t need to add that directly to the WordPress site. Instead, we shall add the tracking code via the Google Tag Manager.
Google Tag Manager – Set Up
Once you’re done with the Google Analytics setup, you need to set up the Google Tag Manager next. You can use the same Google account to sign up with Google Tag Manager; it helps maintain sync among different Google tools. Now, you need to add a new account page by providing the account’s name and clicking on the continue button.
Google Tag Manager Account Creation
The next step involves adding a container for your account, and it could either be an iOS or website or Android platform since we are taking a WordPress website, so our container would be the website.
You can always create the container in the name of your website’s domain name. For a single account, you will be able to add multiple containers. After adding the container, click on the create button to proceed.
After completing the above steps, Google Tag Manager will lead you to the container creation, and you’ll be able to view the container dashboard. This final step readies your Google Tag Manager account, and you can add a tag of your choice. Click on the ‘create new tag’ menu to do so.
The next steps involve choosing a tagged product, and you can do that from the 20+ templates for integration available. We shall choose Google Analytics for this article, but you can add as many tags and choose any product that fits your requirements. You also have the liberty to choose custom HTML for adding custom code snippets.
Google Analytics ID
You’ll have to choose Google Analytics as the product for the tag, and next, you shall have to select between two options: Universal Analytics or Classic Analytics. You will have to provide the analytics tracking ID, the unique code Google uses to identify your website. You will get access to this ID after logging into your Google Analytics account.
Choose the account and the property for your website, and then you need to click on the tracking information to find the tracking code link. For finding the Google Analytics tracking ID, you need to click on the tracking code that redirects you to the page for tracking code, and here you shall find the UA tracking ID.
UA Tracking ID for Google Analytics
Copy the UA tracking ID and put it in Google Tag Manager, and choose the track type as Page View while clicking on the continue button to move ahead.
Adding the Tracking ID
The tag configuration wizard has to be set up for triggering the tag, and you will have to select all the pages. Now, you will have to click on the create button.
Triggering the tag
The Google Tag Manager reveals the tracking code that you will have to add to the WordPress site. Just copy the code.
Adding Tag Manager Code in WordPress
For adding the tag manager code, you’ll have to install and activate the Insert Headers and Footers plugin. Next, you need to move to the settings menu and insert the Headers and Footers.
Adding Google Tag Manager code in WordPress
You have to paste the tag manager code within the header section and then clicking on the save button stores all your settings. If you want to avoid installing the plugin, you can add the Google Tag Manager code directly to the WordPress theme or child theme. Now, edit the header.php template while pasting the code after the <body> tag.
Publishing the Container
Unless you publish the container, the tags within the Google Tag Manager won’t go live, and for this, you need to move to the dashboard for Google Tag Manager and publish the container by clicking on the publish button.
Publish the Edits in Google Tag Manager
Preview of your WordPress website is available, and Google Tag Manager will display the tags fired for each page visit.
Now, this completes the entire process, and you’ve managed to successfully install and set up Google Tag Manager for a WordPress site.