Mixpanel Community Icon

Should We Include Opting-In Logic for Certain User Conditions?

·
·

If users meeting certain conditions have been opted out, would it be better to explicitly write the opting-in logic in the code as well?

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    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

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Based on the knowledge sources provided, it would indeed be better to explicitly write the opting-in logic in your code, even if you have already opted out certain users. This approach provides more control and clarity in managing user tracking preferences. Here's why:1. Flexibility: By implementing both opt-out and opt-in logic, you have more flexibility in managing user preferences. This allows you to handle scenarios where a user's status might change over time.2. Explicit consent: The opt-in logic allows you to clearly capture when a user consents to tracking, which is particularly important for privacy compliance.3. SDK support: Mixpanel's SDKs provide methods for both opting out and opting in users. For example, the JavaScript SDK offers both opt_out_tracking() and opt_in_tracking() methods.Here's an example of how you might implement this in JavaScript:LBKS// Opt out logic mixpanel.opt_out_tracking();LBKS// Later, when conditions are met to opt back in mixpanel.opt_in_tracking();LBKSThis approach is supported by the information from Mixpanel SDKs: Javascript Privacy-Friendly Tracking> , which states:"Once the user is ready to be tracked, call .opt_in_tracking() to start tracking."By explicitly including both opt-out and opt-in logic, you ensure that you have full control over when tracking occurs, which is crucial for maintaining user privacy and complying with data protection regulations.

    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.