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?
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.
Choose the name and location of a container, which will eventually contain all of your tags.
After the log-in confirmation, you will see a pop-up window with the code.
Here there are two possible ways to proceed:
- Copy the proposed code snippets and insert all of them at the beginning of your each page’s code.
- 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.”
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:
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.
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.