ga_push.ssga.inc in GA Push 7
SSGA: method and functions
File
inc/ga_push.ssga.incView source
<?php
/**
* @file
* SSGA: method and functions
*/
/**
* GA Push Method callback: SSGA (php).
*/
function ga_push_method_ssga($push, $type, $options) {
if (class_exists('ssga')) {
$ga = new ssga();
// Set your Google Analytics key:
$id = !empty($options['tid']) ? $options['tid'] : variable_get('googleanalytics_account', '');
$ga
->setAccountId($id);
// Set your charset:
$ga
->setCharset("UTF-8");
// Set your hostname:
// @TODO: domain integration.
$ga
->setHostName($GLOBALS['base_url']);
// Set language:
$ga
->setLanguage($GLOBALS['language']->language);
// Set an event based on:
// http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
switch ($type) {
case GA_PUSH_TYPE_EVENT:
// Complete optional parameters:
$push += array(
'eventLabel' => '',
'eventValue' => 1,
);
$ga
->setEvent($push['eventCategory'], $push['eventAction'], $push['eventLabel'], $push['eventValue']);
break;
}
// Push the event.
$ga
->create();
}
else {
// @TODO: Throw an error
}
}
Functions
Name | Description |
---|---|
ga_push_method_ssga | GA Push Method callback: SSGA (php). |