Google Analytics Glossary

Add Google Analytics to Drupal

Image of Iron Brands

Published on Nov 23, 2023 and edited on Apr 8, 2024 by Iron Brands

Google Analytics can provide great insights to improve the performance and user experience on your Drupal website. Thankfully, Drupal allows for straightforward integration of Google Analytics. Here is how you can integrate GA, step by step.

Let's dive in!

  1. Set Up a Google Analytics Property
  2. Install the Google Analytics Module
  3. Configure the Module
  4. Verify the Setup
  5. Final Thoughts

Before we dig in I want to show you something. I promise it's worth it...

Google Analytics is great, but also complex and a bit clunky. If you just want a straightforward dashboard with the insights you need, GA is not a great place to start. Additionally, Google doesn't care about privacy and GA requires an annoying cookie banner.

That's why I built Simple Analytics, a privacy-friendly and simple analytics tool - no personal data, no cookies, just the insights you need in a straightforward dashboard.

Here is how it looks vs GA. Feel free to check our live analytics to get an idea for your project. (It is free btw)

All right, enough about us. Now let's get into answering your question!

Can you spot the difference between the dashboards?

Set Up a Google Analytics Property

Ensure you have a Google Analytics 4 property. In your Google Analytics account, create a new property and obtain the "Measurement ID" (formatted like 'G-XXXXXXXXXX'). You will need this ID later.

Install the Google Analytics Module

Drupal has a module specifically for integrating Google Analytics which simplifies the process:

-. Download the Google Analytics Module: You can find the module at Drupal.org or use Drush to download it:

<pre class="not-prose px-2 py-1 rounded-lg whitespace-pre-wrap text-base bg-gray-100 dark:bg-gray-700"><code class="hljs">    drush <span class="hljs-selector-tag">dl</span> google_analytics
</code></pre>

-. Install the Module: Through your Drupal admin interface, navigate to 'Extend', find the Google Analytics module, and install it. Alternatively, you can use Drush:

<pre class="not-prose px-2 py-1 rounded-lg whitespace-pre-wrap text-base bg-gray-100 dark:bg-gray-700"><code class="hljs"><span class="hljs-attribute">    drush en google_analytics</span>
</code></pre>

Configure the Module

Once installed, configure the module:

  • Access Module Settings: Go to 'Configuration' > 'System' > 'Google Analytics'.
  • Enter Your GA Measurement ID: In the settings, input your Google Analytics Measurement ID.
  • Configure Additional Settings (optional): The module provides additional settings like tracking links, downloads, and user roles. Configure these based on your specific requirements.

Verify the Setup

After configuration, verify that your site is correctly sending data to GA:

. Check Real-time Reports: In your GA dashboard, navigate to the 'Real-time' section to see if it's recording visits.

  • Use Browser Tools: Tools like Google Analytics Debugger for Chrome can help confirm that tracking is working as expected.

Final Thoughts

Adding Google Analytics to your website can give you great insights. However, ask yourself: is Google Analytics the right tool for you?

GA is an overpowered solution for straightforward analytics. If you're looking for a simple and intuitive dashboard with the insights you need, there are better alternatives. Yes, I’m talking about my own product (Simple Analytics), but there are others out there as well.

I hated using Google Analytics for my projects. It's clunky, there are hundreds of dashboards and it doesn't look appealing. Also Google doesn't care about privacy or ethics. That's why I decided to build my own and more intuitive web analytics tool.

If this resonates with you, feel free to give Simple Analytics a spin. You just need to add the script to your website and off you go. This takes about one minute- and there is a free version as well!

Enjoy!