function _prod_check_googleanalytics in Production check & Production monitor 6
Same name and namespace in other branches
- 7 prod_check.module \_prod_check_googleanalytics()
File
- ./
prod_check.module, line 1670
Code
function _prod_check_googleanalytics($caller = 'internal') {
$check = array();
$error = FALSE;
$ga_account = variable_get('googleanalytics_account', 'UA-');
$severity = $value_nok = $msg_nok = $msg_ok = '';
$title_ok = 'settings';
$text_ok = 'Check the !link to verify if they are as you expect.';
$title = 'Google Analytics';
$path = 'admin/settings/googleanalytics';
if ($caller != 'internal') {
$path = PRODCHECK_BASEURL . $path;
}
if (!module_exists('googleanalytics')) {
$error = TRUE;
$severity = $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING;
$value_nok = t('Disabled');
$msg_nok = t('You have not enabled the !link module. If you wish to track and optimise your site !link is absolutely necessary.', prod_check_link_array($title, 'http://drupal.org/project/google_analytics'));
}
elseif (empty($ga_account) || $ga_account == 'UA-') {
$error = TRUE;
$severity = $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR;
$value_nok = t('Not properly configured.');
$msg_nok = t('You did not !link! Tracking will not be functional!', prod_check_link_array('enter a Google Analytics account', $path));
}
$check['prod_check_googleanalytics'] = array(
'#title' => t($title),
'#state' => !$error,
'#severity' => $severity,
'#value_ok' => t('Enabled'),
'#value_nok' => $value_nok,
'#description_ok' => prod_check_ok_title($title_ok, $path, $text_ok),
'#description_nok' => $msg_nok,
'#nagios_key' => 'GA',
'#nagios_type' => 'state',
);
return prod_check_execute_check($check, $caller);
}