DavisNT has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189338

Change subject: Add option for GA anonymizeIp
......................................................................

Add option for GA anonymizeIp

Added configuration parameter $wgGoogleAnalyticsAnonymizeIP
For more info see https://support.google.com/analytics/answer/2763052?hl=en

Change-Id: I36a08c9a34224ba99c7faa785f7eea8fa7684aba
---
M googleAnalytics.hooks.php
M googleAnalytics.php
2 files changed, 10 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/googleAnalytics 
refs/changes/38/189338/1

diff --git a/googleAnalytics.hooks.php b/googleAnalytics.hooks.php
index 88d9cc2..9f77b3e 100644
--- a/googleAnalytics.hooks.php
+++ b/googleAnalytics.hooks.php
@@ -7,8 +7,8 @@
         * @return bool
         */
        public static function onSkinAfterBottomScripts( Skin $skin, &$text = 
'' ) {
-               global $wgGoogleAnalyticsAccount, $wgGoogleAnalyticsOtherCode, 
$wgGoogleAnalyticsIgnoreNsIDs,
-                          $wgGoogleAnalyticsIgnorePages, 
$wgGoogleAnalyticsIgnoreSpecials;
+               global $wgGoogleAnalyticsAccount, 
$wgGoogleAnalyticsAnonymizeIP, $wgGoogleAnalyticsOtherCode,
+                          $wgGoogleAnalyticsIgnoreNsIDs, 
$wgGoogleAnalyticsIgnorePages, $wgGoogleAnalyticsIgnoreSpecials;
 
                if ( $skin->getUser()->isAllowed( 'noanalytics' ) ) {
                        $text .= "<!-- Web analytics code inclusion is disabled 
for this user. -->\r\n";
@@ -38,6 +38,9 @@
 EOD
 . $wgGoogleAnalyticsAccount . <<<EOD
 ', 'auto');
+
+EOD
+. ( $wgGoogleAnalyticsAnonymizeIP ? "  ga('set', 'anonymizeIp', true);\r\n" : 
"" ) . <<<EOD
   ga('send', 'pageview');
 
 </script>
diff --git a/googleAnalytics.php b/googleAnalytics.php
index c43bc8e..f2e922f 100644
--- a/googleAnalytics.php
+++ b/googleAnalytics.php
@@ -6,7 +6,7 @@
 $wgExtensionCredits['other'][] = array(
        'path' => __FILE__,
        'name' => 'Google Analytics Integration',
-       'version' => '3.0.0',
+       'version' => '3.0.1',
        'author' => array( 'Tim Laqua', 
'[https://www.mediawiki.org/wiki/User:DavisNT Davis Mosenkovs]' ),
        'descriptionmsg' => 'googleanalytics-desc',
        'url' => 
'https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration',
@@ -20,6 +20,10 @@
 // Google Universal Analytics account id (e.g. "UA-12345678-1")
 $wgGoogleAnalyticsAccount = '';
 
+// Don't store last octet (or last 80 bits of IPv6 address) in Google 
Universal Analytics
+// For more info see https://support.google.com/analytics/answer/2763052?hl=en
+$wgGoogleAnalyticsAnonymizeIP = true;
+
 // HTML code for other web analytics (can be used along with Google Universal 
Analytics)
 $wgGoogleAnalyticsOtherCode = '';
 

-- 
To view, visit https://gerrit.wikimedia.org/r/189338
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36a08c9a34224ba99c7faa785f7eea8fa7684aba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/googleAnalytics
Gerrit-Branch: master
Gerrit-Owner: DavisNT <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to