Overview
Mixpanel gives you full control over the data you send to Mixpanel and provides you with the tools necessary to respect a customer’s request to opt out of tracking. When a user is opted out, no data is sent to Mixpanel for that user, meaning their events won’t be tracked or available in Mixpanel. Here, we share best practices for tracking in a privacy-friendly way.Opting Users Out of Tracking
Mixpanel’s client-side libraries include an ‘opt_out’ method that allows you to manage a user’s request to opt out of tracking. This allows you to quickly flag a user when they choose to opt out of tracking during the cookie consent management process. The client-side ‘opt_out’ method sets a flag in the user’s browser cookie or local storage, preventing data from being sent to Mixpanel. The opt-out state persists across sessions, meaning that if a user has opted out, they will remain opted out even if they close and reopen the app or website, unless the cookie/local storage is cleared or they explicitly opt back in. For mobile SDKs, when the ‘opt_out’ method is called, any events and people updates that have not been sent to Mixpanel (i.e., those still in the local queue) are deleted from the device. This ensures that even data collected just before opting out, like App Open events, does not get sent to Mixpanel. Once opted out, the Mixpanel SDKs will continue to function normally, but will not send any data to the Mixpanel project. This means that calls to tracking methods, like track or identify, will essentially be ignored for the opted-out user. The client-side ‘opt out’ call will not affect server-side events. For server-side implementations, you need to manage the opt-out process manually. The server is responsible for generating IDs, maintaining ID persistence, and managing the opt-out state of users.Opting Users In For Tracking
The ‘Opt In’ methods in used to allow users to opt into tracking after they have been previously opted out or when the SDK is initialized with users opted out by default. When the Opt In method is called, it triggers an event called “$opt_in”, which appears as “Opt In” in your project. This event is sent to Mixpanel to indicate that the user has opted into tracking. Locally, a flag is set in the user’s cookie/local storage to indicate to the SDK that the user consents to data tracking. After calling the ‘Opt In’ method, Mixpanel will start collecting and sending data for that user. This includes events, user properties, and other tracking information.Disabling Geolocation
Mixpanel’s Web and Mobile libraries use IP addresses to enrich events with geographic information like city, country, and region. Mixpanel does not store IP addresses, but rather, only uses IPs to assign geolocation properties to data upon ingestion. You can disable this using the following configuration options in each of our SDKs:ip property value to 0. Learn more about ignoring IP addresses here.
Anonymizing Users
Mixpanel does not know, or need to know, any identifying information about users (like email or phone number). Mixpanel only needs to know that a set of events was performed by a particular user ID. You choose the ID and how you want to send that to Mixpanel. If you want to analyze aggregate user behavior without being able to drill down into any particular user, we recommend generating a hash of some unique ID of the user and using that hash as the user’s ID when you call the.identify() method in our SDKs.
Blacklisting Default Properties
Our JavaScript library automatically captures default properties to help enrich your data, but you can choose to prevent the setting of default properties using the property_blacklist config option. To prevent default event properties from being sent, specify a list of properties to blacklist on library load, for example:Javascript