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

ga_push

545 sites Security covered
View on drupal.org

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
Release cadence
1 day
Stability
0% stable

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