Commit dd6d4515 authored by firebus's avatar firebus Committed by hass
Browse files

#1147322: Added Site Speed report support

parent e27b96a5
......@@ -371,6 +371,14 @@ function googleanalytics_admin_settings_form($form_state) {
);
}
// Allow tracking of page load times.
$form['advanced']['googleanalytics_trackpageloadtime'] = array(
'#type' => 'checkbox',
'#title' => t('Site Speed reporting'),
'#default_value' => variable_get('googleanalytics_trackpageloadtime', 0),
'#description' => t('The Site Speed report measures the page load time (latency) for a sample of pageviews on your website pages. For more information see <a href="@url">Site Speed</a> page.', array('@url' => 'https://www.google.com/support/analyticshelp/bin/answer.py?answer=1205784'))
);
$form['advanced']['codesnippet'] = array(
'#type' => 'fieldset',
'#title' => t('Custom JavaScript code'),
......
......@@ -42,6 +42,7 @@ function googleanalytics_uninstall() {
variable_del('googleanalytics_trackfiles');
variable_del('googleanalytics_trackfiles_extensions');
variable_del('googleanalytics_trackmailto');
variable_del('googleanalytics_trackpageloadtime');
variable_del('googleanalytics_trackoutbound');
variable_del('googleanalytics_translation_set');
variable_del('googleanalytics_visibility_pages');
......
......@@ -254,6 +254,11 @@ function googleanalytics_page_alter(&$page) {
else {
$script .= '_gaq.push(["_trackPageview", ' . $url_custom . ']);';
}
if (variable_get('googleanalytics_trackpageloadtime', 0)) {
$script .= '_gaq.push(["_trackPageLoadTime"]);';
}
if (!empty($codesnippet_after)) {
$script .= $codesnippet_after;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment