Mixpanel Community Icon

Configuring Event Filters for Your Domain

·
·

How can I configure that events from my domain should only be considered?

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

    Hi Anshul S., 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
    ·
    ·

    To configure Mixpanel to only consider events from your specific domain, you can use the tracking via proxy feature. This approach allows you to route events through a proxy server in your own domain, which can help ensure that only events from your domain are tracked. Here's how you can set it up: 1. Set up a proxy server: The simplest way is to use Mixpanel's sample nginx config. This configuration redirects calls made to your proxy server to Mixpanel.2. Point the Mixpanel SDK to your proxy server: For the JavaScript SDK, you need to add the following code before the Mixpanel JS snippet: LBKSconst MIXPANEL_CUSTOM_LIB_URL = "https://<YOUR_PROXY_DOMAIN> /lib.min.js";LBKSmixpanel.init('YOUR_PROJECT_TOKEN', { api_host: 'https://<YOUR_PROXY_DOMAIN> ' // set the proxy server as the api_host });LBKSReplace <YOUR_PROXY_DOMAIN> with your actual proxy server's domain.For the React Native SDK, you would initialize Mixpanel like this: LBKSconst serverURL = '<YOUR_PROXY_DOMAIN> '; // set the server URL to your proxy const trackAutomaticEvents = false;LBKSconst mixpanel = new Mixpanel( 'YOUR_PROJECT_TOKEN', trackAutomaticEvents, serverURL );LBKSmixpanel.init();LBKSBy implementing this setup, you ensure that events are routed through your own domain, effectively limiting tracking to your specific domain.For more detailed information, you can refer to: Mixpanel SDKs: Javascript Mixpanel SDKs: React Native

    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.