How to integrate Google Analytics with Drupal 8

How to integrate Google Analytics with Drupal 8

Probably the first place among web analytics services belongs to Google Analytics, which is the most widely used analytics site on the Internet now. You can apply Google Analytics in content marketing, in social media marketing, in e-mail marketing and almost anywhere. This feature-rich tool allows you evaluate the effectiveness of your current campaigns and find smart marketing solutions for future. Two additional versions of it have also been created: Google Analytics for mobile apps and Google Analytics 360 Suite. Also, the Drupal community have developed a module to help Drupal site owners implement this service more easily.

How can Google Analytics module save your time & efforts?

In order to obtain all of Universal Analytics’ benefits and track every page that your web resource contains, Google suggest you use a tracking code. You have to copy and paste this javascript snippet into every page’s code. This is not hard if your site is not very big, but if you have a web portal with numerous pages, it can be a tremendously monotonous and tedious activity. So make life easier with the Google Analytics module. Just paste a tracking ID in its configuration page and that’s enough. Sounds great, isn’t it? Let’s go step by step.

How to enable Google Analytics module in Drupal 8?

First, go to this link to create a GA account. After filling in all the fields that you see, press a blue button called “Get Tracking ID” at the end of this page.

create Google Analytics account

After accepting all the terms of service agreement, you get a tracking ID in UA-XXXXXXXX-X format.

tracking ID, tracking code in Google Analytics

Leave the tab with GA account open. Now login to your Drupal site using the admin credentials. Download and install the Google Analytics module as you normally install Drupal modules on your website and then enable it. There are two versions now available: 7th and 8th. But we recommend you build your site with Drupal 8 and install the Drupal 8 version of the GA module.

After installing, go back to the tab with the Google Analytics account and copy the Tracking ID from there. Paste it in the field titled “Web Property ID” on your website: Configuration→Google Analytics→General Settings→Web Property ID. Click “Save Configuration” and that’s it. Your Google Analytics is now set up.

Now you can track data, monitor statistics, and see ways to optimize your website — and therefore business. If you have any questions regarding this, please contact our specialists who are always ready to help.

1 vote, Rating: 5

Read also


Establishing your online presence can really aid your offline business. There are lots of paid and free tools helping you with this. You can check out the...


The SEO Checklist module tells you what modules to install and what actions to perform so you can use the best SEO practices with Drupal. It does it in a user-friendly and popular way that most...


“Would you please give me your email address?” is any marketer’s silent question to their target...


Would you like to be more convincing in your marketing campaign, come to the right place at the right time with the right message, increase your conversions, and save your time and money? These...


Although SEO and UX have completely different purposes, they both are paramount to your website. How can we make peace between these two requirements which appear, at first, to be fierce opponents...

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join the people who have already subscribed!

Want to be aware of important and interesting things happening? We will inform you about new blog posts on Drupal development, design, QA testing and more, as well news about Drupal events.

No charge. Unsubscribe anytime