Since the iOS SDK 3.0 of Google Analytics has been released, plenty of changes have been made with the API. There is one big problem we encounter that has to do with the anonymize IP feature.
In Germany one has to anonymize the IPs by law when using some tracking framework. With the previous version of the SDK (2.0) it worked like this:
tracker.anonymize = YES;
where tracker
is an instance of id<GAITracker>
.
Now with the version 3.0 one has to use the set method of the tracker:
[tracker set:kGAIAnonymizeIp value:@"?????"];
The signature of the method is
- (void)set:(NSString *)parameterName
value:(NSString *)value;
and that's the problem. What should the parameter value be? @"YES"
or @"NO"
? @"ON"
or @"OFF"
? @"1"
or @"0"
? Are these parameters case-sensitive?
There is no information about the value
in the documentary. Does anyone know what parameter is correct to anonymize the IPs?
The IP-anonymization feature in Universal Analytics sets the last octet of IPv4 user IP addresses and the last 80 bits of IPv6 addresses to zeros in memory shortly after being sent to Google Analytics. The full IP address is never written to disk in this case.
Google collects IP addresses from your website visitors whenever you send a hit to their systems (think each time a page finishes loading). That means every Google Analytics hit from your tags is attached to an IP address. But Google truncates this data before it enters your analytics reports.
IP anonymization, also known as IP masking, is a method of replacing the original IP address with one that cannot be associated with or traced back to an individual user. This can be done by setting the last octet of IPV4 addresses or the last 80 bits of IPv6 addresses to zeros. For example, 10.200.
Work for me:
[tracker set:kGAIAnonymizeIp value:[@NO stringValue]];
or
[tracker set:kGAIAnonymizeIp value:[@YES stringValue]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With