Beautifulthemes Blog

WordPress News, Trends, Tutorials and Information

WORDPRESS TUTORIALS

How to Install and Setup Google Tag Manager for WordPress?

Last Updated: 6 mins By: BeautifulThemes Author

Understanding your audience is a major part in determining the success of your website. If you have a general idea about what content your audience looks for on your website and what content on your website is more successful, you’ll have an easier time improving these factors and gain more success.

For this purpose, many tools have been created to help you collect and compile this information and use them accordingly. However, these tools vary in purposes and use and managing them collectively can be quite difficult.

So, Google has created an amazing tool to help you manage all these tools in the form of Google Tag manager. Google Tag manager works by letting marketers set website tags collective and manage them. This gives website owners the power to manage JavaScript and HTML snippets and tags used to add various products, tracking features and more.

Why should we use Google Tag Manager?

Google Tag Manager is an extremely resourceful web tool that lets you add useful snippets to collect and send data to other third-party tools. These third-party tools include AdWords conversion tracking, DoubleClick floodlight as well as Google Analytics.

Google Tag Manager allows you to easily allow these snippets to work on your website, manage its data accordingly and delete them if necessary. Google Tag Manager or GTM for short, works by providing an interface to manage these snippets easily instead of requiring you to modify their code directly.

Thus, here’s where the need for Google Tag Manager comes, instead of hard-coding the snippet codes and requiring tough changes in order to modify data tracking, you can simply use GTM to separately create tags and add them, all without barely any understanding of HTML.

Using analytic and tracking tools are made much easier, especially for beginners by the use of Google Tag Manager. So, let’s talk about how to integrate this into WordPress.

Setting up Google Tag Manager

First of all, let’s sign up for Google Tag Manager and register an account for your website.

For this, open the website and click on Sign up to start a new account. <link>

Google_Tag_manager-Sign_up

Login with your Gmail id and the website will refer you to the new account page.

Here places the name of your account. Then select the country your organization or business is based on.

Google_Tag_manager-Sign_up2

Click on the Share Data anonymously option to allow you to send the data to Google while still hiding your website’s private details. This allows Google to save data from multiple websites, create benchmarks for comparisons and improve the service as a whole.

Then click on Continue.

Next, you will insert your container name. This is generally your website’s name. Select your container as Web and click on create. Then accept the agreement by clicking on Yes on the top right to create your GTM container.

Google_Tag_manager-Sign_up3

A set of codes will be provided to you, however, keep this copied for now as it will not be much of a use right now.

Creating tags for Google Tag Manager

Now we need to set tags for various tools for your website. First, open your Google Tag Manager dashboard.

Click on Add New Tag to start.

Google_Tag_manager-New_tag

Then, in the new window, click on Choose a tag type. Here you can select what type of snippet to create, for demonstration let’s use Universal Analytics for Google Analytics.

Google_Tag_manager-new_tag_analytics

In the tag configuration menu, choose the Track type. For example, every page view triggers the tag for Google analytics. This trigger can be changed using Track type.

Google_Tag_manager-New_tag_Track

Next, click on the Variable type/Google Analytics settings menu and choose New variable type.

Set your tracking ID in the Tracking ID field. This will be provided to you if you sign in for Google Analytics individually using your website. To learn about this tracking code and Google Analytics as a whole, refer to here.

Google_Tag_manager-Tracking_code

Google_Tag_manager-New_tag_Track2

Then click on save to create the new variable settings by naming it down. Choose this new variable that you just named.

Now for Triggering, you can choose what pages trigger the Google analytics tag. For now, we will select All Pages. Furthermore, you can insert the exceptions and choose what pages do not trigger the tags. Once done, name your Tag and Click on Save to create your tag.

Google_Tag_manager-New_tag2

Now we need to copy our containers onto our WordPress website to start tracking. You can use the code we saved at the start but if you need to find it again, you can do it by using the Admin settings.

Simply click on Admin and then Click on Install Tag Manager. Then copy the two separate codes provided to you.

Google_Tag_manager-install

We need to insert these codes into all our pages in order to start tracking.

Google_Tag_manager-install2

The first code uses javascript for tracking while the second one uses iFrames. This means if a viewer has disabled Javascript the second code is used for tracking.

Enabling Google Tag Manager

Now we insert these codes into our WordPress website. For this, simply open your WordPress theme editor and manage the Header.php template.

First, go to your WordPress admin dashboard and hover over Appearance. Then click on editor to open your theme templates. On the far-right list of Theme files, scroll down and click on Theme Header.

Google_Tag_Manager-Theme_header

This is your header.php file and here we will insert the Google Tag Manger’s container code. Take both the codes we saved earlier and copy them right under the “<Body>” section.

Google_Tag_manager-Theme_header

This should enable Google Tag Manager on all your pages.

To check whether GTM functions well, open Google Tag Manager on a tab and enable Preview mode on it. Simply click on the Preview on your Google Tag Manager workspace window.

Google_tag_manager-Preview_mode

Once this is enabled, open your website in a separate tab and Google Tag Manager should show you a debug window.

Google_Tag_manager-preview

Thus, you can easily enable various Tags and analytical tools on your website. You can add more tags for DoubleClick Floodlight, AdWords, Google Optimize in a similar way by simply adding newer tags in the Workspace window.

Concluding:

Using these steps, you can enable Google Tag Manager and tons of other useful tools on your website to study your demographic tools. These tools allow you to easily improve your website by studying what kind of content to focus and what products to sell.

Furthermore, do remember that enabling tag still requires you to have these tools enabled and requires you to use their respective IDs and codes.

For added benefits, we’ve listed these useful tools that can help you immensely to improve various aspects of your website and study the important elements you should focus on:

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top

Pin It on Pinterest