@@ -248,7 +249,7 @@ function googleanalytics_admin_settings_form($form_state) {
...
@@ -248,7 +249,7 @@ function googleanalytics_admin_settings_form($form_state) {
'#title' => t('Track DoubleClick data'),
'#title' => t('Track DoubleClick data'),
'#description' => t('If checked, the alternative Google <a href="@doubleclick">DoubleClick data tracking</a> is used to enable AdWords remarketing features. If you choose this option you will need to <a href="@privacy">update your privacy policy</a>.', array('@doubleclick' => url('http://support.google.com/analytics/bin/answer.py', array('query' => array('answer' => '2444872'))), '@privacy' => url('http://support.google.com/analytics/bin/answer.py', array('query' => array('answer' => '2636405'))))),
'#description' => t('If checked, the alternative Google <a href="@doubleclick">DoubleClick data tracking</a> is used to enable AdWords remarketing features. If you choose this option you will need to <a href="@privacy">update your privacy policy</a>.', array('@doubleclick' => url('http://support.google.com/analytics/bin/answer.py', array('query' => array('answer' => '2444872'))), '@privacy' => url('http://support.google.com/analytics/bin/answer.py', array('query' => array('answer' => '2636405'))))),
'#description'=>t("Code in this textarea will be added <strong>after</strong> _gaq.push(['_trackPageview']). This is useful if you'd like to track a site in two accounts."),
'#description'=>t("Code in this textarea will be added <strong>after</strong> <code>ga('send', 'pageview');</code>. This is useful if you'd like to track a site in two accounts."),
form_set_error('googleanalytics_codesnippet_before',t('Do not add the tracker code provided by Google into the javascript code snippets! This module already builds the tracker code based on your Google Analytics account number and settings.'));
form_set_error('googleanalytics_codesnippet_before',t('Do not add the tracker code provided by Google into the javascript code snippets! This module already builds the tracker code based on your Google Analytics account number and settings.'));
form_set_error('googleanalytics_codesnippet_after',t('Do not add the tracker code provided by Google into the javascript code snippets! This module already builds the tracker code based on your Google Analytics account number and settings.'));
form_set_error('googleanalytics_codesnippet_after',t('Do not add the tracker code provided by Google into the javascript code snippets! This module already builds the tracker code based on your Google Analytics account number and settings.'));
// Checking for tracking code URI here, as $ua_code is displayed in the form.
// Checking for tracking code URI here, as $ua_code is displayed in the form.
$this->assertRaw('google-analytics.com/ga.js','[testGoogleAnalyticsPageVisibility]: Tracking code is displayed on admin subpage.');
$this->assertRaw('google-analytics.com/analytics.js','[testGoogleAnalyticsPageVisibility]: Tracking code is displayed on admin subpage.');
$this->drupalGet('');
$this->drupalGet('');
$this->assertNoRaw($ua_code,'[testGoogleAnalyticsPageVisibility]: Tracking code is NOT displayed on front page.');
$this->assertNoRaw($ua_code,'[testGoogleAnalyticsPageVisibility]: Tracking code is NOT displayed on front page.');
...
@@ -93,18 +93,18 @@ class GoogleAnalyticsBasicTest extends DrupalWebTestCase {
...
@@ -93,18 +93,18 @@ class GoogleAnalyticsBasicTest extends DrupalWebTestCase {
variable_set('cache',1);
variable_set('cache',1);
// Test whether DNT headers will fail to disable embedding of tracking code.
// Test whether DNT headers will fail to disable embedding of tracking code.
$this->drupalGet('',array(),array('DNT: 1'));
$this->drupalGet('',array(),array('DNT: 1'));
$this->assertRaw('_gaq.push(["_trackPageview"]);','[testGoogleAnalyticsDNTVisibility]: DNT header send from client, but page caching is enabled and tracker cannot removed.');
$this->assertRaw('ga("send", "pageview");','[testGoogleAnalyticsDNTVisibility]: DNT header send from client, but page caching is enabled and tracker cannot removed.');
// DNT works only with caching of pages for anonymous users disabled.
// DNT works only with caching of pages for anonymous users disabled.
variable_set('cache',0);
variable_set('cache',0);
$this->drupalGet('');
$this->drupalGet('');
$this->assertRaw('_gaq.push(["_trackPageview"]);','[testGoogleAnalyticsDNTVisibility]: Tracking is enabled without DNT header.');
$this->assertRaw('ga("send", "pageview");','[testGoogleAnalyticsDNTVisibility]: Tracking is enabled without DNT header.');
// Test whether DNT header is able to remove the tracking code.
// Test whether DNT header is able to remove the tracking code.
$this->drupalGet('',array(),array('DNT: 1'));
$this->drupalGet('',array(),array('DNT: 1'));
$this->assertNoRaw('_gaq.push(["_trackPageview"]);','[testGoogleAnalyticsDNTVisibility]: DNT header received from client. Tracking has been disabled by browser.');
$this->assertNoRaw('ga("send", "pageview");','[testGoogleAnalyticsDNTVisibility]: DNT header received from client. Tracking has been disabled by browser.');
// Disable DNT feature and see if tracker is still embedded.
// Disable DNT feature and see if tracker is still embedded.
$this->assertRaw('_gaq.push(["_trackPageview"]);','[testGoogleAnalyticsDNTVisibility]: DNT feature is disabled, DNT header from browser has been ignored.');
$this->assertRaw('ga("send", "pageview");','[testGoogleAnalyticsDNTVisibility]: DNT feature is disabled, DNT header from browser has been ignored.');
}
}
functiontestGoogleAnalyticsTrackingCode(){
functiontestGoogleAnalyticsTrackingCode(){
...
@@ -118,40 +118,34 @@ class GoogleAnalyticsBasicTest extends DrupalWebTestCase {
...
@@ -118,40 +118,34 @@ class GoogleAnalyticsBasicTest extends DrupalWebTestCase {