Project:Google Analytics
Version:6.x-3.x-dev
Component:Code
Category:feature request
Priority:minor
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hello,

would it be possible to add a simple option for the new feature "_gat._anonymizeIp();" to anonymize the IP addresses of visitors?

The functionality is described under:
http://code.google.com/intl/de-DE/apis/analytics/docs/gaJS/gaJSApi_gat.h...

Possibly this would be a great feature which you could reach with minimum effort.
Please contact me, if you need any further information or help.

Thank you very much.

Comments

#1

I just implemented the needed functionality and tested it, here's the code:

googleanalytics.module, please add in line 168 of V 6.2.2

<?php
    $anonymize_ip
= variable_get('googleanalytics_anonymizeip', 0);
    if(!empty(
$anonymize_ip)){
     
$script .= '_gat._anonymizeIp();';
    }
?>

googleanalytics.admin.inc, please add in line 251 of V 6.2.2

<?php
    $form
['advanced']['googleanalytics_anonymizeip'] = array(
   
'#type' => 'checkbox',
   
'#title' => t('Anonymize visitors IP address'),
   
'#default_value' => variable_get('googleanalytics_anonymizeip', 0),
   
'#description' => t('Tell Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage. Note that this will slightly reduce the accuracy of geographic reporting.')
  );
?>

If I shell add it to the dev version, it would be nice if you could provide me with CVS access. Furthermore I could add test cases for this functionality.

You may find the patch file for the latest Head revision attached.

#2

Sorry, patch here!

Please check it first.

AttachmentSizeStatusTest resultOperations
google_analytics-anonymize_ips-811156-0.patch1.79 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in google_analytics-anonymize_ips-811156-0.patch.View details

#3

Version:6.x-2.x-dev» 6.x-3.x-dev
Category:feature request» support request
Priority:critical» normal
Status:active» fixed

How about adding the line to the Custom Javascript section BEFORE?

This is at least only possible in the NEW async tracking code... and therefore depends on #648284: Support for Asynchronous Tracking

#4

I think it is not a good idea to add it as custom js because basic users won't understand. Why not add a checkbox?

In some countries like Germany for example collecting all this user information is not allowed by law. In my oppinion this option will clearly be used!

Why can it only be used with async tracking in your oppinion? I don't think so!

Quote from Google: "For async tracking, use the _gaq global object instead." - We don't!
But maybe I am wrong?

#5

Category:support request» feature request
Priority:normal» minor
Status:fixed» needs review

As I know - there is no law in Germany that does not allow you to collect the data... only the German data protection officers complain, but complain for good reasons :-). The day may come and German Google datacenters will open their doors...

I'm sorry - it looked like the new push syntax to me. In general I'm willingly to enable it by default... data protection has a higher priority for me than tracking. :-). Nevertheless this is minor as it's still possible to use if you care about it. Aside - removing only the last IP octet will not make you non-traceable... this may still be "personenbeziehbare Daten".

#6

Status:needs review» needs work

The last submitted patch, google_analytics-anonymize_ips-811156-0.patch, failed testing.

#7

Well there are laws concerning this topic, but at the moment they just don't prosecute.
The point is that you are not allowed to save personal data if it is not explicitly needed, but however... this should not be topic.

All in all it is a good feature, but I agree, not that important to be critial.

Why should it not be added to V6.x.2x.dev? (and 3.x.dev of course)?

#8

Version:6.x-3.x-dev» 7.x-1.x-dev
Status:needs work» needs review

D7 patch for this feature.

The D7 version runs an update hook and if the site country is Germany (only available in D7) it automatically enables the anonymizeIp feature.

NOTE: _gaq.push(["_anonymizeIp"]); seems not working yet. There is a known workaround, but I do not like to implement it and better wait for Google to fix this API bug.

AttachmentSizeStatusTest resultOperations
811156_anonymizeIp_7x.patch3.58 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#9

And the 6.x-3.x version.

AttachmentSizeStatusTest resultOperations
811156_anonymizeIp_6x.patch2.56 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 811156_anonymizeIp_6x.patch.View details

#10

Version:7.x-1.x-dev» 6.x-3.x-dev

Switch test branch

AttachmentSizeStatusTest resultOperations
811156_anonymizeIp_6x.patch2.56 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 811156_anonymizeIp_6x_0.patch.View details

#11

Status:needs review» fixed

I've committed the code, but keep in mind - until Google fixed the bug with _gaq.push(["_anonymizeIp"]); - this will not work. :-(

#12

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#13

Found some people reporting that _gaq.push(["_gat._anonymizeIp"]) works in async code. Interims workaround has been committed.

http://blog.webalytics.de/2010/06/anonymisieren-von-ip-adressen-mit-goog...