Closed Bug 946705 Opened 11 years ago Closed 10 years ago

[Privacy] Google Analytics anonymize Ip

Categories

(Websites :: Web Analytics, task)

task
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sjw+bugzilla, Unassigned)

References

()

Details

(Keywords: privacy, Whiteboard: [kb=1270272][qa-])

I propose to anonymize the IPs, that are sent to Google.
More info here too:

https://support.google.com/analytics/answer/2905384?hl=en

We don't have access to IPs in GA to start and this would only reduce geo accuracy some. When we are doing A/B testing and funnel analysis, we are usually at the country level for geography.
Of course it's a goal conflict, but I think we should prefer the privacy.
Gareth: Can you check to see if this anonymizer function works with Universal Analytics and the GA tag manager?
Flags: needinfo?(garethcull.bugs)
Chris: Yes. There is an anonymizer function in Universal Analytics. More details available here:
https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#anonymizeip

Also, there is a setting available in GTM here: https://support.google.com/tagmanager/answer/3281077?hl=en
Flags: needinfo?(garethcull.bugs)
Users can also totally opt-out of GA via an add-on:

http://www.mozilla.org/en-US/privacy/policies/websites/#opt-out
(In reply to Chris More [:cmore] from comment #5)
> Users can also totally opt-out of GA via an add-on:
> 
> http://www.mozilla.org/en-US/privacy/policies/websites/#opt-out

An Add-On would just be a workaround. You could use NoScript, too or disable JavaScript. But I think Mozilla should also do something on their own to protect users privacy and this is a way to get still the statistics.
Also note that in some states (e.g. Germany) you *have to* use this snippet.
This week was the #DPD14. It would be a good time to enable this feature. :)
Flags: needinfo?(chrismore.bugzilla)
Keywords: privacy
(In reply to Gareth Cull [:garethc] from comment #4)
> Chris: Yes. There is an anonymizer function in Universal Analytics. More
> details available here:
> https://developers.google.com/analytics/devguides/collection/analyticsjs/
> advanced#anonymizeip
> 
> Also, there is a setting available in GTM here:
> https://support.google.com/tagmanager/answer/3281077?hl=en

Gareth: Can you put the classic analytics tags here with the anonymizeIp so that we can get a PR done?
Flags: needinfo?(chrismore.bugzilla) → needinfo?(garethcull.bugs)
Here you go. We need to add _gaq.push (['_gat._anonymizeIp']); prior to _trackPageview in the GA Snippet:

var _gaq = _gaq || [];
_gaq.push (['_setAccount', 'UA-XXXXXXX-YY']);
_gaq.push (['_gat._anonymizeIp']);
_gaq.push (['_trackPageview']);

https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat#_gat._anonymizeIp
Flags: needinfo?(garethcull.bugs)
(In reply to Gareth Cull [:garethc] from comment #10)
> Here you go. We need to add _gaq.push (['_gat._anonymizeIp']); prior to
> _trackPageview in the GA Snippet:
> 
> var _gaq = _gaq || [];
> _gaq.push (['_setAccount', 'UA-XXXXXXX-YY']);
> _gaq.push (['_gat._anonymizeIp']);
> _gaq.push (['_trackPageview']);
> 
> https://developers.google.com/analytics/devguides/collection/gajs/methods/
> gaJSApi_gat#_gat._anonymizeIp

Ok, so the complete tag should be:

<script>
var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
_gaq.push(['_setAccount', 'UA-36116321-1']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setAllowAnchor', true]);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;

    var prefix = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www');
    ga.src = prefix + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
})();
</script>

right?
Looks good Chris.
Gareth: can you review this PR?

https://github.com/mozilla/bedrock/pull/1686
Commits pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/895bc7ce7ad2709b2a677ac2196c04c8619665fd
Bug 946705: Add anonymize tag to GA

https://github.com/mozilla/bedrock/commit/51b40b563c327e5865fd519264d05cba771f022e
Merge pull request #1686 from chrismore/anonymize-ga-ips-bug-946705

Bug 946705: Add anonymize tag to GA
Whiteboard: [kb=1270272]
Yay, thanks for making this decision!
Before you launch the new script to the sites I'll push bug 946697, which could be included in this small update.
fixed on stage www.allizom.org
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Commit pushed to master at https://github.com/mozilla/remo

https://github.com/mozilla/remo/commit/4ea92884bd0649073235d3622325bf5ad8345953
[bug 946705] Update Google Analytics options.

* Mask IPs that are send to Google.
* setAllowLinker == true
* setAllowAnchor == true
Whiteboard: [kb=1270272] → [kb=1270272][qa-]
Commit pushed to master at https://github.com/mozilla/nocturnal

https://github.com/mozilla/nocturnal/commit/af405d7351a722ae9343e9a5ebf74c01e0e5c437
Update index.html

See bug 946705, bug 946697 
Updated URLS to https
Corrected Facebook URL
You need to log in before you can comment on or make changes to this bug.