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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anybody’s picture

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

    $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

    $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.

Anybody’s picture

Sorry, patch here!

Please check it first.

hass’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Category: feature » support
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

Anybody’s picture

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?

hass’s picture

Category: support » feature
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".

Status: Needs review » Needs work

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

Anybody’s picture

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)?

hass’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
3.58 KB

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.

hass’s picture

FileSize
2.56 KB

And the 6.x-3.x version.

hass’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
FileSize
2.56 KB

Switch test branch

hass’s picture

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. :-(

Status: Fixed » Closed (fixed)

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

hass’s picture

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...