Should the mixpanel.opt_out_tracking api be called before the init api?
Hi jtw, Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Based on the knowledge sources provided, there is no explicit information about whether mixpanel.opt_out_tracking()
should be called before the init
API. However, I can provide some relevant information about opting out of tracking in Mixpanel.According to the JavaScript SDK documentation, the Mixpanel JavaScript SDK is initialized with tracking enabled by default. The opt_out_tracking()
method is used to opt the user out of data tracking and cookies/local storage for the current Mixpanel instance.If you want to initialize the library with users opted out of tracking by default, you can use the opt_out_tracking_by_default
configuration when initializing Mixpanel. Here's an example: LBKSmixpanel.init('YOUR_PROJECT_TOKEN', { opt_out_tracking_by_default: true });LBKS
This approach allows you to start with tracking disabled from the beginning, without needing to call opt_out_tracking()
separately.If you need to opt users out of tracking after initialization, you can call mixpanel.opt_out_tracking()
at any point after the Mixpanel instance has been initialized.To ensure that tracking is disabled from the start, it's recommended to either use the opt_out_tracking_by_default
configuration during initialization or call opt_out_tracking()
immediately after initialization.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.