Home Life Trends How to Set Up and Use Google Tag Manager in WordPress (In...

How to Set Up and Use Google Tag Manager in WordPress (In 4 Steps)

Lots of people find out about Google Analytics, however not everybody has heard of Google Tag Manager. These two instruments usually get confused, as a result of you'll be able to combine them in quite a lot of helpful methods. However, they every want to be arrange individually, even in case you intend to use them collectively.

By utilizing Google Tag Manager in WordPress, you should utilize ‘tags’ to handle the JavaScript in your website that sends data to third-party providers. For instance, you should utilize Google Tag Manager in WordPress to arrange Google Analytics and have it monitor customized occasions. The main advantage of Google Tag Manager is that it’s a lot easier than including code manually.

In this text, we’ll speak extra about what Google Tag Manager is and the way it works. Then we’ll train you ways to arrange Google Tag Manager in WordPress and use it to configure Google Analytics. Let’s get to work!

The Google Tag Manager homepage.

These days, a lot of web sites use third-party providers similar to Google Analytics to accumulate knowledge. This is as a result of the knowledge collected allows websites to goal their providers extra precisely, and to determine areas that may be improved.

However, you’ll often have to add some code to your website in order that data could be handed alongside to related knowledge assortment applications. What Google Tag Manager does is offer you a approach to combine code into your website and handle it utilizing a single device. Google Tag Manager in WordPress works very effectively with Google Analytics, and with different in-house merchandise similar to Adwords. Plus, it integrates with a number of exterior providers, together with Twitter, Bing Ads, and extra.

The better part is that, by way of these integrations, Google Tag Manager helps you high-quality tune what knowledge you would like to purchase out of your website. For instance, you should utilize this answer to add Google Analytics to your web site, and arrange new metrics and occasions for it to monitor. You can do that with out a further device, however that often requires you to add customized code. By utilizing Google Tag Manager in WordPress, the method is tremendously simplified.

Post Contents:

Key Features

  • Integrate a number of providers along with your web site utilizing a single device.
  • Add any code that the providers supported by Google Tag Manager require to work.
  • Configure the metrics you need your third-party providers to monitor, utilizing a ‘tag’ system.
  • Test your tags utilizing built-in debugging instruments.

Price

As is often the case with Google merchandise, there are each free and paid variations out there for Google Tag Manager. In our expertise, the free model of the service is greater than highly effective sufficient for many instances. If you’re in getting some superior options, nevertheless, you may take into account investing in Google Tag Manager 360 (its prices vary relying on how you plan to use the platform).

How to Set Up and Use Google Tag Manager in WordPress (In 4 Steps)

Setting up Google Tag Manager in WordPress could be completed in two easy steps. However, we’ve additionally included two further steps in this tutorial, to reveal how Google Tag Manager can really be used alongside Google Analytics.

Step 1: Set Up a New Google Tag Manager Account

The very first thing you’ll want to do is set up a Google Analytics account. Then log into your Google account, and entry the Google Tag Manager platform. When you do this, you’ll be prompted to arrange a brand new account for the web site you need to join to Google Tag Manager. Choose a reputation in your website, and point out which nation you’re utilizing the service from:

Configuring your new account.

Next, click on on the Continue button. The service will ask you to point out your website’s URL, and to select which platform you plan to use this ‘container’ on. Since you need to use Google Tag Manager in WordPress, go along with the Web choice and choose Create:

Configuring your new container.

The phrases of service settlement will show subsequent. After you settle for it, your new container shall be up and operating.

As quickly as you arrange your Google Tag Manager account (also called a container), the platform will show a few code snippets you’ll want to add to your website. The first one goes inside the <head> tags for each web page in your website, whereas the second goes with the <physique>  tags:

Your Google Tag Manager integration code.

Instead of including all that code to every web page, it’s greatest to edit your lively theme’s header.php file. That approach, WordPress will routinely add each snippets to all pages when you’re utilizing that theme. To do that, you’ll want to use File Transfer Protocol (FTP), which allows you to entry your web site and ship recordsdata again and forth (in addition to edit them).

To use FTP, you’ll want a shopper that helps the protocol. FileZilla is a superb answer that’s beginner-friendly and straightforward to use. Once you install and run FileZilla, this system will ask you to enter your FTP credentials, which aren't the identical as those you utilize to entry WordPress. Most net hosts will assign you distinctive FTP credentials, and you'll be able to often discover them by way of your internet hosting management panel.

If you’re an 000Webhost user, for instance, your FTP credentials will present up in your internet hosting dashboard below Settings > General:

Your FTP details.

With these credentials in hand, open FileZilla once more and kind them into the empty fields on the high of the display, then click on on Quickconnect:

Accessing your website via FTP.

When FileZilla connects to your web site, two folders will present up in the bottom-right quadrant of the display. The one we’re in is named public_html. This is also called your WordPress root folder, because it incorporates all of your web site’s core recordsdata:

Open this folder now, and navigate to the wp-content/themes listing. There must be a number of folders inside, one for every theme put in in your web site. Find the one which corresponds to your lively theme:

Your themes' directory.

Access that folder now, and search for the header.php file inside. Once you find it, right-click on the file and choose the View/Edit choice. This will Download a duplicate of the file to your pc, and open it utilizing your default text editor. The contents of your header.php file will range relying on the theme you’re utilizing, however there are solely two elements that matter proper now. There must be two tags close to the highest of the display that learn <head> and </head> with some code in between, like this:

Your header.php file's head tags.

You’ll need to paste the primary a part of your Google Tag Manager script inside these two tags. Here’s an instance of how that code may look:

<!-- Google Tag Manager -->
<script>(perform(w,d,s,l,i){w[l]=w[l]--[];w[l].push({'gtm.begin':
new Date().getTime(),occasion:'gtm.js'});var f=d.getElementsByTagIdentify(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,doc,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->

Keep in thoughts that the above code shouldn’t be used verbatim, as a result of it doesn’t include your account’s distinctive identifier. We’ve included it to provide you with a normal concept of how the code ought to seem. Also, be sure that whenever you copy and paste your personal snippet, it doesn’t intervene with any of the prevailing code inside the head tags. The easiest method to do that is to add the code proper after the primary tag, or proper earlier than the ultimate one.

Moving on, you’ll additionally want to add a second snippet of code after your physique tag. We’ve highlighted an instance of how that tag ought to look in the screenshot beneath:

Your header.php's body tag.

Now, right here’s an instance of how your Google Tag Manager physique code ought to look:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
top="0" width="0" type="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

In this case, we advocate including the code proper after the primary line with a physique tag. When you’re completed, save your modifications to the file and shut it. FileZilla will ask you if you'd like to change the model of the file in your server with the one you simply edited. Make certain to say sure, or Google Tag Manager gained’t be lively in your website.

That’s it! You simply efficiently arrange Google Tag Manager in WordPress. Now, let’s take a look at an instance of the way you may put Google Tag Manager into motion.

Step 3: Set Up Google Analytics Using Google Tag Manager

As we talked about earlier, you'll be able to combine Google Tag Manager with Google Analytics. This helps you to collect knowledge pertaining to particular facets of your WordPress website. In this instance, we’ll present how one can monitor the web page views in your web site.

To do that, go to your Google Tag Manager dashboard and choose the Tag tab. A brand new web page will open, with a button labeled New. Click on it now:

Creating a new tag.

Then, choose the Tag Configuration choice on the window that pops up subsequent:

Configuring your new tag.

Multiple choices will seem now. Select Universal Analytics, as this presents the easiest way to combine Google Analytics with WordPress:

Choosing what type of integration to add.

Once you select the mixing you need, Google Tag Manager will ask you what occasions you need to monitor. The default choice is about to web page views, which works effectively for our instance. Next, choose the choice that reads Enable overriding settings in this tag. A brand new area will seem, asking you in your Google Analytics Tracking ID:

The tracking ID field.

Since you have already got a Google Analytics account arrange in your web site, you also needs to have a monitoring ID. To discover it, go to your Google Analytics dashboard and enter the Admin tab. Once there, search for the part known as Tracking Info below your web site’s title:

Checking out your website's tracking info.

If you click on on the Tracking Code tab, you’ll discover your Tracking ID proper close to the highest of the display:

Your website's tracking ID.

Return to Google Tag Manager, and paste that code into the Tracking ID area in your new tag’s settings:

Adding your tracking ID to Google Tag Manager.

Now, transfer on to the Triggering tab. Here, you'll be able to configure the set off Google Analytics will use to file the occasion you selected. Since you’re monitoring web page views, set the set off to Page View for All Pages:

Configuring your tag's trigger.

Select the Save button on the high of the display, and Google Tag Manager will retailer your new tag. However, it’s not prepared to go simply but. If you need your new tag to work, you’ll want to click on the Submit button on the high of the display:

Submitting your new tag to your website.

With that, you’ve efficiently added Google Analytics monitoring for a selected occasion to your web site. Now, let’s see if it’s working.

Step 4: Check Out Your Website’s Analytics

In the earlier step, you configured Google Analytics to monitor web page views in your web site. Keep in thoughts that if you'd like to add further tags to your web site, you’ll want to accomplish that on a case-by-case foundation, following the identical directions.

For now, let’s verify that your new tag is working. To do this, go to your Google Analytics dashboard and search for the Behavior Overview tab. Once there, it is best to see a number of metrics relating to web page views:

Checking out your website's analytics.

Keep in thoughts that the screenshot above incorporates knowledge collected from a well-established web site, so don’t be discouraged in case your numbers aren’t that prime. From this level on, you'll be able to regulate your web page views, and use this data to make enhancements to your website.

Conclusion

Using Google Tag Manager could be intimidating at first. Like most different Google instruments, there’s a lot you are able to do with it that getting began could be troublesome. However, utilizing Google Tag Manager in WordPress isn’t significantly sophisticated. Plus, it allows you to do numerous helpful issues, similar to including Google Analytics monitoring to your web site.

To recap, right here’s a fast rundown of how to use Google Tag Manager to arrange Google Analytics in WordPress:

  1. Set up a brand new Google Tag Manager account.
  2. Install Google Tag Manager through your header.php file.
  3. Set up Google Analytics utilizing Google Tag Manager.
  4. Check out your web site’s analytics.

Do you have got any questions on how to use Google Tag Manager in WordPress? Ask away in the feedback part beneath!