How to Add Google Analytics on a Drupal 8 Website With the Help of a Module

by Hamza Zia  February 6, 2017

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 is a very solid indicator of the popularity of the website in both the people and search engines.

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 your Drupal 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!

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 Google Analytics module. 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.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About 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.

Stay Connected:

You Might Also Like...