This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

🔊 Web Growth Summit is here! Learn from industry experts on July 17-18, 2024. REGISTER NOW→

How To Install Google Tag Manager On Drupal

Updated on March 28, 2018

4 Min Read

Like all other websites, Drupal websites require marketing for retaining and increasing their share of audience and revenue.

Install Google Tag Manager on Drupal

Google Tag Manager for Drupal is an excellent tool for adding and updating tags to your website without editing code of your website. The best thing about the tool is that it is free to use for all users.

Implementing Google Tag Manager in Drupal 7 was pretty straightforward thanks to a custom module. The same idea is carried into Drupal 8, although the custom module is not available on the official Drupal module directory. However, the module is available at the GitHub. For a streamlined experience, especially when considering the integration of Drupal hosting, this approach stands as a dependable choice.

The process of integrating Google Tag Manager in Drupal websites comprises of:

  1. Install Module on the Drupal website.
  2. Create an account for Google Tag Manager.
  3. Copy the container ID.
  4. Configure the module.
  5. Verify whether GTM is present at the website.
  6. Implement the Google Analytics script through Google Tag Manager.

Install the Module on Your Drupal Website

First of all, download the google_tag module from GitHub. Now login to your Drupal website as the admin, navigate to the Extend tab and click Install new module button. Next, upload the module’s zip file you downloaded earlier.

module install

After the installation is complete, enable the module.

Create an Account in Google Tag Manager

Go to Google Tag Manager and use your Google account to login. After logging in, click Create Account. Give the account the name of your website and continue. You will now be required to give a container name. Enter a relevant name or the name of your website and click Create.

installation google tag manager

Copy the Container ID

After clicking Create on the previous screen, a splash screen with code snippets will appear. Copy the container ID from this screen.

Copy the Container ID

Configuration of the google_tag Module

I will now go back to the Drupal website. Once there, click the Configuration tab and navigate to Google Tag Manager. On the very first screen, paste the container ID (copied earlier) into the field titled Container ID. Next, click Save configuration.

module container id gtm

Verify GTM Code on Your Website

The simplest way to check whether the Google Tag Manager is properly implemented on your website is by using the inspect element option. Just go to your website’s homepage, right click and select inspect element from the context menu. In the screen that opens, search for “Google Tag Manager”. If you have successfully implemented Google Tag Manager, you should see a script like the one in the screenshot below.

GTM script

Implement Google Analytics Through Google Tag Manager

As a website admin, you could use Google Tag Manager to implement various scripts very easily. To demonstrate this functionality, I will demonstrate how to install Google Analytics using GTM.

Go to your Google Tag Manager account, and navigate to the following directory: Tags > New > Name your Tag > Tag Configuration > Select Universal Analytics.

Universal Analytics GTM

Next, go to the Google Analytics account and copy the Tracking ID.

google analytics tracking id

Now simply paste the Google Analytics Tracking ID into the Google Tag Manager’s Tag configuration and click Save.

Google Analytics Tracking ID

That’s it! You’ve successfully implemented Google Analytics through GTM into your Drupal website.

Nothing as Easy as Deploying Drupal Apps on Cloud

With Cloudways, you can have your Drupal apps up and running on managed cloud servers in just a few minutes.


Google Tag Manager is yet another example of how modules make everything so simple in Drupal. As you have seen in this tutorial, implementing Google Tag Manager in Drupal website is really easy! If you found this blog post useful you might like to check out another post by us on: Speed Up Drupal Websites With Google AMP. If you wish to contribute to the discussion, do leave a comment below!

Share your opinion in the comment section. COMMENT NOW

Share This Article

Shahzeb Ahmed

Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour


  • 0


  • 0


  • 0


  • 0



For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now