public function GoogleAnalyticsGaService::getOutput in Analytics 7
Returns the output of the analytics service.
Parameters
array $context:
Return value
array A structured, renderable array.
Overrides AnalyticsServiceInterface::getOutput
File
- analytics_google/
src/ GoogleAnalyticsGaService.php, line 33
Class
Code
public function getOutput(array $context) {
$actions = array();
$actions[] = array(
$this
->getMachineName() . '._setAccount',
$this
->getConfiguration()['id'],
);
if (variable_get('analytics_privacy_anonymize_ip', FALSE)) {
$actions[] = array(
$this
->getMachineName() . '._anonymizeIp',
);
}
$actions[] = array(
$this
->getMachineName() . '._trackPageview',
);
$actions = array_merge($actions, module_invoke_all('analytics_google_ga_actions', $this, $context));
drupal_alter('analytics_google_ga_actions', $actions, $this, $context);
$output = array();
$actions_code = theme('analytics_google_ga_actions_js', array(
'actions' => $actions,
'service' => $this,
));
$output['#attached']['js'][] = array(
'data' => $actions_code,
'type' => 'inline',
'preprocess' => FALSE,
'scope' => 'footer',
);
static $added = FALSE;
if (!$added) {
$added = TRUE;
$code = theme('analytics_google_ga_js', array(
'service' => $this,
));
$output['#attached']['js'][] = array(
'data' => $code,
'type' => 'inline',
'weight' => 100000,
'preprocess' => FALSE,
'scope' => 'footer',
);
}
return $output;
}