summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2009-03-08 11:41:32 (GMT)
committer hass2009-03-08 11:41:32 (GMT)
commit5bcd0dacb94e470e8dc6f3b308aa81a164e97e6b (patch)
tree3a7d0e78ae920269d87840d02d223b93f3517a38
parent485f60a1915801c5eb209c2539d61649a969b26c (diff)
#347359: AdSense reports integration with Google Analytics
-rw-r--r--googleanalytics.admin.inc7
-rw-r--r--googleanalytics.install1
-rw-r--r--googleanalytics.module5
3 files changed, 13 insertions, 0 deletions
diff --git a/googleanalytics.admin.inc b/googleanalytics.admin.inc
index 7f63ba1..3c5cbed 100644
--- a/googleanalytics.admin.inc
+++ b/googleanalytics.admin.inc
@@ -217,6 +217,13 @@ function googleanalytics_admin_settings_form(&$form_state) {
'#disabled' => (module_exists('search') ? FALSE : TRUE),
);
+ $form['advanced']['googleanalytics_trackadsense'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Track AdSense ads'),
+ '#description' => t('If checked, your AdSense ads will be tracked in your Google Analytics account.'),
+ '#default_value' => variable_get('googleanalytics_trackadsense', FALSE),
+ );
+
$form['advanced']['codesnippet'] = array(
'#type' => 'fieldset',
'#title' => t('Custom JavaScript code'),
diff --git a/googleanalytics.install b/googleanalytics.install
index 58f757d..f4d8188 100644
--- a/googleanalytics.install
+++ b/googleanalytics.install
@@ -33,6 +33,7 @@ function googleanalytics_uninstall() {
variable_del('googleanalytics_cache');
variable_del('googleanalytics_last_cache');
variable_del('googleanalytics_site_search');
+ variable_del('googleanalytics_trackadsense');
variable_del('googleanalytics_js_scope');
variable_del('googleanalytics_custom');
variable_del('googleanalytics_roles');
diff --git a/googleanalytics.module b/googleanalytics.module
index d478472..2bdc7f8 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -81,6 +81,11 @@ function googleanalytics_init() {
drupal_add_js(array('googleanalytics' => $link_settings), 'setting', 'header');
drupal_add_js(drupal_get_path('module', 'googleanalytics') .'/googleanalytics.js', 'module', $scope);
}
+
+ // Custom tracking.
+ if (variable_get('googleanalytics_trackadsense', FALSE)) {
+ drupal_add_js('window.google_analytics_uacct = ' . drupal_to_js($id) . ';', 'inline', 'header');
+ }
}
}