View source
<?php
function analytics_google_hook_info() {
$info['analytics_google_universal_actions'] = array(
'group' => 'analytics',
);
$info['analytics_google_universal_actions_alter'] = array(
'group' => 'analytics',
);
$info['analytics_google_ga_actions'] = array(
'group' => 'analytics',
);
$info['analytics_google_ga_actions_alter'] = array(
'group' => 'analytics',
);
return $info;
}
function analytics_google_theme() {
$info['analytics_google_universal_js'] = array(
'variables' => array(
'actions' => array(),
'service' => NULL,
),
'file' => 'analytics_google.theme.inc',
);
$info['analytics_google_ga_actions_js'] = array(
'variables' => array(
'actions' => array(),
'service' => NULL,
),
'file' => 'analytics_google.theme.inc',
);
$info['analytics_google_ga_js'] = array(
'variables' => array(
'service' => NULL,
),
'file' => 'analytics_google.theme.inc',
);
return $info;
}
function analytics_google_analytics_service_info() {
$info['google_universal'] = array(
'label' => t('Google Universal (analytics.js)'),
'class' => 'GoogleUniversalAnalyticsService',
'multiple' => TRUE,
);
$info['google_ga'] = array(
'label' => t('Google Analytics (ga.js)'),
'class' => 'GoogleAnalyticsGaService',
'multiple' => TRUE,
);
return $info;
}
function _analytics_google_validate_id($element, &$form_state) {
$value = $element['#value'];
if ($value == '') {
return;
}
elseif (!preg_match('/^UA\\-\\d+\\-\\d+$/', $value)) {
form_error($element, t('%name is not in a valid format.', array(
'%name' => $element['#title'],
)));
}
}