mixpanel / mixpanel-flutter

Official Flutter Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
67 stars 75 forks source link

Location disabled, but sometimes still gets send through. #106

Open AFASbart opened 1 year ago

AFASbart commented 1 year ago

Hello everyone!

We have implemented Mixpanel in Flutter with this package. And for privacy reasons we have disabled the tracking of locations.

But we can still see that some events still contains the location of the user. Even though it is probably only <5% of the events, 1 is too many for us.

Our event contains the country, region and city property. We do not know if this is a Flutter package or the Mixpanel servers doing something funky.

zihejia commented 1 year ago

hi @AFASbart , would you mind sharing how you disable the tracking of locations? As a best practice, you should call setUseIpAddressForGeolocation immediately after initializing the Mixpanel instance. This will minimize the chance of events containing the user's location.

AFASbart commented 1 year ago

This is the code we use, isn't there a 100% failsafe option?

        _instance._mixpanelInstance ??= await Mixpanel.init(
            useDevKey ? devKey : prodKey,
            trackAutomaticEvents: true);

        // Setting up any extra settings.
        _instance._mixpanelInstance!
            .setServerURL("https://api-eu.mixpanel.com");
        _instance._mixpanelInstance!.setUseIpAddressForGeolocation(false);