cmackay / google-analytics-plugin

Cordova Google Analytics Plugin for Android & iOS
Apache License 2.0
89 stars 43 forks source link

how to set Anonymize IP? #43

Closed Freundschaft closed 9 years ago

Freundschaft commented 9 years ago

for us in EU its kind of a strict requirement, is there a possibility to enable it?

Cheers

cmackay commented 9 years ago

I haven't tried but you should be able to enable it by sending the aip parameter prior to tracking requests.

https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#aip

I would try setting the following prior to tracking.

analytics.set('aip', '1');

Let me know how it works out :)

Freundschaft commented 8 years ago

I think this only aplies to the JS version of analytics? for the native ones there is a dedicated invocation available:

https://developers.google.com/android/reference/com/google/android/gms/analytics/Tracker.html#setAnonymizeIp(boolean)

I submitted a pull request on the other analytics plugin which should be recycleble https://github.com/danwilson/google-analytics-plugin/pull/154/files

cmackay commented 8 years ago

I am not sure why that would apply to only the JS version. It is part of the measurement protocol. Are you saying you tried using it and it didn't work? Please feel free to submit a pull request if you like.

petarov commented 8 years ago

I always thought that setAnonymizeIp(boolean) was a kind of synonym to the &aip parameter. At least it should be, because as @cmackay said, &aip is really a part of the analytics protocol itself and not strictly specific to a language API. I've used this so far without really testing it, but I should have another look.