MixpanelAnalyticsService

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)

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.

Constructors

Link copied to clipboard
constructor(mixpanel: MixpanelAPI)

Functions

Link copied to clipboard
open suspend override fun flush()
Link copied to clipboard
open suspend override fun identify(identity: Identity)
Link copied to clipboard
open suspend override fun reset()
Link copied to clipboard
open suspend override fun setEnabled(enabled: Boolean)
Link copied to clipboard
open suspend override fun start()