Question

I want to filter my home ip from mixpanel. In Google Analytics, I can do this by adding a filter to my profile. Is there something similar in mixpanel or a work around to achieve the same result? My app is built in Rails 3, hosted on heroku. Thanks.

Was it helpful?

Solution

Spoke to their support and they'd suggested that I block api.mixpanel.com in my host file, which works.

OTHER TIPS

Blocking the Mixpanel API by running sudo bash -c 'echo "127.0.0.1 api.mixpanel.com" >> /etc/hosts' worked for me on OS X. This also works with Segment.io.

One problem with the above solution is that it is hard edit the hosts file on mobile devices.

Here is a different workaround:

  • Create a "secret" HTML file called x.html (or whatever) that sets a special cookie, and upload it to your site.

    <html>
    <head>
        <title>mixpanel cookie</title>
    
        <script type="text/javascript">
            document.cookie = "analytics-ignore=true; max-age=31536000; path=/";
        </script>
    </head>
    <body>
        setting cookie.
    </body>
    

  • in your site/app, check for this cookie before running the mixpanel initiation script.

    if( document.cookie.indexOf('analytics-ignore') === -1 ) { //...mixpanel code... }

  • Note that you may want to check for the existence of mixpanel variable before calling its methods (mixpanel.track).

Simply visit the x.html page once (well, once per year, per browser, and after clearing your cookies, etc..)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top