Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

GA Push

487 sites Security covered
View on drupal.org

This module allows you to send data to Google Analytics using GA4 or DataLayer push types. It supports various tracking methods including pageviews, events, and e-commerce data, with options for both client-side and server-side tracking.

Supported Push types

You can implement your own methods to communicate with GA.

Google nowadays let you communicate to analytics with the current push types:

Push types GA4 DataLayer Pageview Event Ecommerce Enhanced Ecommerce Social Exceptions

Features:

  • Client and Server side tracking. You can choose which mode better fits your needs!

Dependencies:

Modules that uses ga_push as dependency

Please let us know about new modules that uses GA Push!

Changes Introduced in 2.x Version

We removed the deprecated methods from GA, introduced the GA4 method and kept Datalayer.

We keep the same event types.

We keep the functions:
ga_push_add_ecommerce()
ga_push_add_event()
ga_push_add_pageview()
ga_push_add_social()

Removed options parameter from ga_push_add.

The following properties are not supported on GA4 service:

- *     - 'tid': Override Tracking ID / Web Property ID (Classic User account
- *       aka UA)
- *       of the google analytics module config.
- *       Universal and Classic GA Methods.
- *     - 'cid': Override Universal Client ID of the current user cookie.
- *       Only for Universal GA methods.
- *     - 'utma': Force Classic GA __utma cookie of the current user cookie
- *       Only for Classic GA methods.
- *     - 'utmb': Force Classic GA __utmb cookie of the current user cookie
- *       Only for Classic GA methods.
- *     - 'ua': Override User Agent of the current user.
- *       Only for Universal GA methods.
- *     - 'uip': Override User IP of the current user.
- *       Only for Universal GA methods.

We remove the includes and use services instead.
Example GA4:

/** @var \Drupal\ga_push\GA4MPService $ga4mpService **/
$ga4mpService = \Drupal::service('ga_push.ga4mp');
 
$form_url = 'https://example.com/your-form';
 
// Create the event data array
$event_data = [
  'eventCategory' => 'LandingPage',
  'eventAction' => 'Submit',
  'eventLabel' => $form_url,
];
 
// Send the event
$ga4mpService->sendEvent($event_data, 'GA_PUSH_TYPE_EVENT');

Datalayer:

/** @var \Drupal\ga_push\DataLayerService $datalayerService **/
$datalayerService = \Drupal::service('ga_push.datalayer');

$form_url = 'https://example.com/your-form';

// Create the event data array
$event_data = [
  'event' => 'GAEvent',
  'eventCategory' => 'LandingPage',
  'eventAction' => 'Submit',
  'eventLabel' => $form_url,
];

// Send the event
$datalayerService->pushData($event_data, 'GA_PUSH_TYPE_EVENT');

Or use the functions ga_push_add*

Credits
Initial development by GeduR.
Development of this module is sponsored by Metadrop.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
5
Tracked since
Mar 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 5
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.0.0-alpha3 Pre-release 10–11 Mar 10, 2025
2.0.0-alpha2 Pre-release 10–11 Mar 10, 2025
2.0.0-alpha1 Pre-release 10–11 Mar 10, 2025
3.0.0-alpha1 Pre-release 10–11 Mar 10, 2025
3.x-dev Dev 10–11 Mar 7, 2025