MixpanelAnalyticsService
class MixpanelAnalyticsService(mixpanel: MixpanelAPI) : AnalyticsLifecycleService, IdentifiableUserService, ConsentService(source)
Mixpanel's lifecycle and identity, over a MixpanelAPI the consumer owns.
Data residency is set on the MixpanelAPI before you hand it over — setServerURL is a method on the instance, so this adapter leaves it alone.
Before consent arrives, Mixpanel collects. Its own default is opted in, and start does not opt out: optOutTracking() deletes unflushed events and clears the stored identity, so calling it every launch would discard the previous session and de-identify a consenting user. Use the construction-time switch instead:
val options = MixpanelOptions.Builder().optOutTrackingDefault(true).build()
val mixpanel = MixpanelAPI.getInstance(context, token, trackAutomaticEvents, options)Content copied to clipboard
setEnabled then opts in, and the state persists across launches.
Mixpanel's logging is set on the MixpanelAPI too, with setEnableLogging. To keep the user id away from Mixpanel, register the provider without identity.