How to add a filter to Mixpanel (like in Google analytics)
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.
Spoke to their support and they'd suggested that I block api.mixpanel.com in my host file, which works.
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..)
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.
精彩评论