You are here

function ga_push_add_event in GA Push 8

Same name and namespace in other branches
  1. 7 ga_push.module \ga_push_add_event()

Push a GA event.

Event tracking allows you to measure how users interact with the content of your website. For example, you might want to measure how many times a button was pressed, or how many times a particular item was used in a web game.

Example:

ga_push_add_event(array(
  'eventCategory' => 'Videos',
  'eventAction' => 'Play',
  'eventLabel' => 'Gone With the Wind',
  'eventValue' => 1,
  'nonInteraction' => FALSE,
));

Parameters

array $push: An associative array containing:

  • eventCategory: string Typically the object that was interacted with (e.g. button).
  • eventAction: string The type of interaction (e.g. click).
  • eventLabel: string (optional) Useful for categorizing events (e.g. nav buttons).
  • eventValue: int (optional) Values must be non-negative. Useful to pass counts (e.g. 4 times).
  • non-interaction: bool (optional) A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation. Defaults to FALSE.

string $method_key: Method key.

array $options: Extra options.

See also

https://developers.google.com/analytics/devguides/collection/analyticsjs...

https://developers.google.com/analytics/devguides/collection/gajs/eventT...

ga_push_add()

2 calls to ga_push_add_event()
Event::doExecute in src/Plugin/RulesAction/Event.php
Executes the action with the given context.
ga_push_form_validate_get_validate_errors in modules/form_validate/ga_push_form_validate.module
Push form errors to GA.

File

./ga_push.module, line 411
Drupal Module: GA Push.

Code

function ga_push_add_event(array $push, $method_key = NULL, array $options = []) {
  ga_push_add($push, GA_PUSH_TYPE_EVENT, $method_key, $options);
}