You are here

function ga_push_add_event in GA Push 7

Same name and namespace in other branches
  1. 8 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: @see ga_push_add()

array $options: @see ga_push_add()

See also

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

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

2 calls to ga_push_add_event()
ga_push_action_push_event in ./ga_push.rules.inc
Add a push event from a rules action.
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 405
Drupal Module: GA Push.

Code

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