Implementing Google Tag Manager (and Google Analytics via it)

Mar 13, 2017
Implementing Google Tag Manager (and Google Analytics via it)

Google provides users all over the world with their free-to-use tools in order to smooth the process of designing and managing different web resources, and to bring a better user experience when exploring the web. We have previously described the benefits of some of these services, such as Google Search Console and Google Analytics (Goals & Filters). Today, we continue to work with the Google Tag Manager. We will learn how to implement the Google Tag Manager on your Drupal website.

What is Google Tag Manager (GTM) useful for?

Google Tag Manager makes it easier for you to add and update tags, or snippets of JavaScript code. This tool replaces hard-coded tags with its dynamic tags on your site or app, so there is no need to rewrite any code. This Tag Management System, with its understandable and friendly UI, is especially useful for digital marketers, IT specialists and webmasters.

How to install Google Tag Manager?

First you have  to create an account in Tag Manager in “Admin” section, using your Google account. Give it the name of your company or brand.

create an account in Tag Manager

Choose the name and location of a container, which will eventually contain all of your tags.

create an account in Tag Manager

After the log-in confirmation, you will see a pop-up window with the code.

google tag manager

Here there are two possible ways to proceed:

  1. Copy the proposed code snippets and insert all of them at the beginning of your each page’s code.
  2. If you have too many pages, we recommend you save time and efforts by using the Google Tag Manager module. Install it as you normally install Drupal modules on your website and then enable it. Copy from the pop-up window just a container ID (highlighted in the screenshot) and paste it only once in the "Container ID" field on your Drupal site (Configuration→Google Tag Manager→Container ID). Then click the blue button "Save configuration."

Now, after the GTM is implemented on your website, you can connect it with GA.

How to install Google Analytics via Google Tag Manager?

To do this, go to your GTM account. Find “WORKPLACE,” then “Tags” and press the red button titled “NEW.”

install Google Analytics via Google Tag Manager

Choose “Tag Configuration.” You’ll see a list. Select “Universal Analytics,” which is listed first in “Featured” section. After clicking on “Universal Analytics” in GTM account, you will see this:

install Google Analytics via Google Tag Manager

Here in the field “Tracking ID” you have to paste the ID that you copied in your Google Analytics account. To do this, look at a screenshot below, go to your GA account, find “Property Settings” → “Basic Settings” → “Tracking Id” and copy the needed information.

 install Google Analytics via Google Tag Manager

After the tracking ID from the Google Analytics account is inserted in the GTM account, the work is completed. It’s pretty easy, isn’t it? You have successfully installed Google Analytics through Google Tag Manager into your Drupal site. Now you can track data, see statistics, make conclusions and optimize your business. If you have any questions, feel free to ask our specialists.

 Get new blog posts by email