How to set up and use Drupal Google Analytics 4?

By: Skynet Technologies USA LLC
8 mins
Drupal Google Analytics 4

Google Analytics 4 is not a newbie now, businesses are aware of it very well. It is gen-next Google Analytics, launched by Google in 2020. Unlike previous Universal Analytics, GA4 can be used for a website or app, or both together.

GA4 uses an advanced machine learning model and delivers out-of-the-box performance in tracking customer behavior and vogue market trends across the platforms.

If not today then tomorrow, but every website must start using Google Analytics 4. Thus, each platform user must know how to set it up and use it. In this article, we will discuss about Google Analytics 4 in Drupal.

If you are using Drupal and wish to install and use Google Analytics 4, we are here to help you. Let’s see how to set up GA4 tracking for your Drupal website and collect & analyse data.


What is Drupal Google Analytics?

Drupal Google Analytics is a module that assists you to collect data about your Drupal website’s traffic and other activities and send it to the Google Analytics platform; that too without any hassle.

You just need to install this module only, then it will automatically add the necessary tracking code to your website so that you can start collecting data.

How to install Drupal Google Analytics?

You can install Drupal Google Analytics in two ways on your Drupal website. The first one is, using the GA module and the other way is, manually adding the tracking code to your site.

If you are using Drupal 8 version and then you can check out the installation guide of Google Analytics on Drupal 8 and its benefits.

Drupal Google Analytics installation using GA module

This module is one of the easiest ways to install Google Analytics on your Drupal website.

Go to the GA module page on and download the latest version of this module. Once the module download is done, log into your Drupal site as an administrator and navigate to the ‘Extend’ page (admin/modules).

There you will find a list of modules that are currently installed on your site. Start scrolling down to that page towards the bottom and click on the ‘Install new module’ link.

Then, on the next page, select the GA module file that you downloaded earlier and click on the ‘Install’ button. As soon as the module has been installed, go to the ‘Modules’ page and scroll to the ‘Google Analytics’ section. There you will find another list of all the GA module’s sub-modules. Select the modules you want to enable and then click on the ‘Install’ button at the bottom of the page.

Coming to the next page, you will be asked to enter your Google Analytics tracking ID. If you do not know about ID; you can find this by logging into your Google Analytics account and navigating to the ‘Admin’ page.

After that, click on the ‘Save Configuration’ button and you are done. The module is good to start with. It will now collect data about your website’s traffic and other activities.

Manually adding the GA tracking code to your Drupal site

If you do not want to go with the GA module, then manually adding the GA tracking code to your Drupal website is another option for you.

To start manually, first login to your Google Analytics account and navigate to the ‘Admin’ page.

There in the ‘Property’ column, you need to click on the ‘Tracking Info’ link. After that, on the next page, there will be your GA tracking code under the ‘Tracking Code section. Copy that code and go to your Drupal site.

Then, login to your Drupal site as an administrator and navigate to the ‘Configuration’ page. You will find a list of configurable settings; there you need to scroll down to the ‘System’ section and then click on the ‘Web Services’ link.

After that, on the next page, scroll down to the ‘Google Analytics’ section and paste your GA tracking code into the ‘Tracking ID’ field. Make sure to check the ‘Enable Tracking’ box as well. And then click on the ‘Save Configuration’ button to start collecting data via Google Analytics. The tracking code will now start gathering data on website traffic and activities.

To view this data, login to your Drupal website and go to Google Analytics link, then navigate to the ‘Reporting’ page. There you will find various reports and charts about website performance.

After installing google analytics, to check whether it is working correctly you should do Drupal site audit so, you can measure traffic and other elements of the website precisely.

How to use Google Analytics 4 in Drupal?

After installation of Drupal Google Analytics on your Drupal website, you will be able to connect with the GA4 property. Once you install the module, you ought to create a GA4 property to start getting website data.

You must follow the process of installing the module, creating a GA4 property, Adding the tracking code to your website, configuring the GA4 settings, and viewing GA4 reports.

  • As mentioned above, install the Drupal Google Analytics module.
  • To create a GA4 property, go to the ‘Configuration’ section of your Drupal site and click on the ‘Google Analytics’ link. Then, click on the ‘Create Property’ button.
  • Once the GA4 property has been created, add the tracking code to the website. We have mentioned above, how to add tracking code to your Drupal site.
  • After that, configuring the GA4 module is crucial. Go to the ‘Configuration’ section of your Drupal site, click on the ‘Google Analytics’ link, and then click on the ‘Configure’ link. Then in the ‘Property’ section, select the GA4 property you created and enter your website’s domain name in the ‘Domain’ field. And finally, click on the ‘Save Configuration’ button.
  • Now you are all set to get reports of your website performance on every facet. As mentioned above, you need to go to the ‘Reporting’ section of your Drupal website, click on the ‘Google Analytics' link, and then ‘View Reports.

Wrapping up

Google Analytics 4 uses ‘Events’ to track user interactions with your website and the ‘Events’ are nothing but any activity a user perform on your website. Each event has properties that you track using GA4. Drupal made it easier by providing a Drupal Google Analytics module.

The latest GA4 is a powerful tool that provides you with accurate insights about the website’s performance, traffic, and other activities. Using it in Drupal has become simple yet effective!

If you are facing any problems while installing Google Analytics 4 on your Drupal website, then hire our Drupal developers who have hands-on experience in this process. Skynet Technologies is a Drupal association organization member who has more than 20 years of experience in drupal website development and in the digital marketing area. Get in touch with us via email at [email protected] or fill out the following form to request a free quote.