Disable Geolocation Collection

Mixpanel’s client-side libraries set user location data, including city, region, and country, as Properties by default.  Mixpanel cross-references the client device's IP address against a local copy of Maxmind’s GeoIP database to estimate geolocation data. The IP address is then discarded. Mixpanel does not store IP addresses.

In order to disable or anonymize geolocation data (i.e., not send city, region, and country by default when using a client-side library), you simply need to stop collecting the user’s IP, which will then not populate the city, region, and country properties. At this time, there is no way to selectively disable one or two of the three location default properties. However, you could disable the three default properties and then set your own custom property for the one or two that you’d still like to collect.

JavaScript

If you don’t want Mixpanel to set city, region, and country by default, you can change the config via your init. This will not collect IP and therefore not populate city, region, and country default properties:

mixpanel.init("YOUR_TOKEN", {'ip':false})

iOS

To disable IP collection on iOS, make a small change in the Mixpanel library installed on the app, changing:

useIPAddressForGeoLocation = YES

to:

useIPAddressForGeoLocation = NO

Android

To disable IP collection on Android, set useIPAddressForGeoLocation to false (NOTE: only available on Android SDK versions > 5.2.0):

<meta-data android:name="com.mixpanel.android.MPConfig.UseIpAddressForGeolocation"
                   android:value="false" />
Did this answer your question?

Comments

0 comments

Article is closed for comments.