Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

GA Push

547 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.

Activity

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

Release Timeline

Releases

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