Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

ga4_google_analytics

2,061 sites Security covered
View on drupal.org

A simple drupal module to integrate Google Analytics 4 (GA4) tracking into your website, providing advanced insights into user behavior and engagement.

With easy installation and configuration, our module empowers website owners to harness the power of GA4's event-driven tracking, allowing you to monitor pageviews, clicks, conversions, and more. Gain a deeper understanding of your audience and optimize your website's performance using the latest in web analytics technology, all within the familiar Drupal environment.

INSTALLATION

CONFIGURATION

  1. Navigate to Administration » Extend and enable the module.
  2. Navigate to Configuration » Web services » GA4 Google Analytics Settings
  3. Configure:
    • GA4 Measurement ID
    • Pages: Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. An example path is /user/* for every user page. or leave empty to use analytics for all pages.
    • Roles: Specify user roles to use analytics with your site when the user has the specific roles or leave empty for all user roles.

How to find your Google Analytics GA4 Measurement ID

Your Google Analytics GA4 Measurement ID can be found by logging into your Google account.

  • Go to Admin Panel in Google Analytics 4.
  • Select the property that you want to get the Measurement ID for.
  • Click on "Data Stream", then click on the Data Stream name.
  • On the next screen, in the top right corner, you will find the Measurement ID that starts with G-

Configure your GA4 settings to filter out URLs matching patterns like /admin/*, /user/*, /node/*/edit etc. from here Configuration » Web services » GA4 Google Analytics Settings. By implementing these exclusions, you can ensure that user-specific or administrative activities are not included in your analytics data, providing a clearer picture of user behavior and website performance.

Steps to Integrate GA4 with Klaro

  1. Enable Klaro module: First, make sure the Klaro module is installed and enabled on your Drupal site. You can find more information on Klaro here.
  2. Enable Google Analytics Service in Klaro: In the Klaro module settings, enable the Google Analytics service.
  3. Configure GA4 Google Analytics Settings: Go to Configuration » Web services » GA4 Google Analytics Settings.
  4. Add Custom Attributes for GA4 Scripts: In the GA4 Scripts Custom Attributes field, add the following code:
    type="text/plain" data-type="application/javascript" data-name="ga"

    Where data-name="ga" corresponds to the machine name of the Klaro service for Google Analytics.

By adding these attributes, Klaro will block the GA4 tracking script from loading until the user has consented to cookies. This ensures compliance with privacy laws (e.g., GDPR).

Activity

Total releases
8
First release
Jan 2025
Latest release
1 month ago
Release cadence
57 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.1.14 Stable Mar 5, 2026
1.1.13 Stable Mar 4, 2026
1.1.12 Stable Dec 3, 2025
1.1.11 Stable Dec 3, 2025
1.1.10 Stable Sep 23, 2025
1.1.9 Stable Sep 23, 2025
1.1.8 Stable Aug 29, 2025
1.1.7 Stable Jan 28, 2025