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.

How To Add Google Analytics On Drupal 8 Using A Module

Updated on March 28, 2018

4 Min Read

For any website administrator, the number of visitors is the most important number of all. For many people, this is the only number that really matters. Traffic on a website and other related metrics are extremely useful indicators of the popularity of a website. Using Google Analytics for Drupal 8 can be the perfect solution.

How to Add Google Analytics on a Drupal 8

Google Analytics is one of the best tools for measuring and analyzing traffic on a website. This all-purpose tool provides real-time updates about the number of visitors on your website. In addition, Google Analytics provide very detailed information about the visitors, including where they are from and how much time they have spent on individual web pages. In its reports, Google Analytics could track and present hundreds of visitor-focused parameters.

In this tutorial, I will take you through the process of setting up Google Analytics on Drupal 8 website. While embedding Google Analytics on a standard website is a pretty straight-forward process, things could get a bit complicated in the case of a feature-rich CMS  Drupal.

Here is the list of steps involved in the process:

  1. Login to Google Analytics
  2. Add Your Drupal Website
  3. Log in to your Drupal website’s admin panel
  4. Install Google Analytics Module
  5. Get Tracking ID for your website
  6. Configure the Module
  7. Test it thoroughly!

Step 1: Login to Google Analytics

The very first thing you need to do is add your Drupal website to Google Analytics. For this, log into the Google Analytics account.

Google login

Step 2: Add Your Drupal Website to Google Analytics

Adding Google Analytics Account

After filling in all the details, click the Get Tracking ID button. This will bring you to the next screen where you will receive the tracking ID and the script to embed into your website. Leave the tab open!

Stop Wasting Time on Servers

Cloudways handle server management for you so you can focus on creating great apps and keeping your clients happy.

Step 3: Login to Your Drupal Website

Once you are done with the Google Analytics website, login to your Drupal website using the admin credentials.

Drupal Login

Step 4: Install the Google Analytics Module

Go to the Google Analytics module page, install the module and enable it. Make sure you select the Drupal 8 version of the module for your Drupal 8 website.

Step 5: Get Tracking ID of Your Website

Go back to the Google Analytics’s tab and copy the Tracking ID from the Property Settings tab.

Step 6: Configure the Google Analytics Module

Now go back to your Drupal website and navigate to Configuration > Google Analytics. In the field for Web Property ID, paste the Tracking ID you got from the Google Analytics account. Set additional settings and save the configuration. The Google Analytics setup is now complete.

Step 7: Test the Installation

To test the installation, go to your Google Analytics account. Click the real-time tab and select Overview. In the case of successful Google Analytics installation and setup, you will see the traffic statistic for your Drupal website.

Conclusion: Start Tracking Your Visitors

The real power of Drupal lies in its very optimized utilization of modules. As you can see from the steps in this tutorial, what would have been a complex installation procedure is made extremely simple by the module that adds Google Analytics on Drupal 8. 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. In case you have a question or an issue, do leave your feedback in the comments.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Create interactive Drupal websites easily on the Cloud.

Host your website on optimized Drupal hosting servers.

Hamza Zia

Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.


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!