How can I disable default collection of city, region, and country or anonymize geolocation data?

Mixpanel’s client-side libraries send user location data (city, region, country) as Properties by default. Mixpanel pulls the user’s IP address and runs it through a third-party IP geolocator (MaxMind). MaxMind then returns city, region, and country, and Mixpanel sets those as Properties. Then, the IP address is discarded - Mixpanel does not store users’ IPs.

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" />