如何向 Mixpanel 添加过滤器(就像在 Google Analytics 中一样)
我想从 mixpanel 中过滤我的家庭 IP。在 Google Analytics 中,我可以通过向我的个人资料添加过滤器来做到这一点。 mixpanel 中是否有类似的东西或解决方法可以达到相同的结果?我的应用程序是用 Rails 3 构建的,托管在 heroku 上。谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
与他们的支持人员交谈,他们建议我在主机文件中阻止 api.mixpanel.com,这有效。
Spoke to their support and they'd suggested that I block api.mixpanel.com in my host file, which works.
上述解决方案的一个问题是在移动设备上很难编辑hosts文件。
这里有一个不同的解决方法:
创建一个名为 x.html(或其他名称)的“秘密”HTML 文件来设置特殊的 cookie,并将其上传到您的网站。
在您的网站/应用程序中,在运行 mixpanel 启动脚本之前检查此 cookie。
if( document.cookie.indexOf('analytics-ignore') === -1 ) {
//...混合面板代码...
}
mixpanel.track
) 之前,您可能需要检查mixpanel
变量是否存在。只需访问
x.html
页面一次(嗯,每年一次,每个浏览器一次,并且在清除 cookie 后等等)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.
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..)通过运行 sudo bash -c 'echo "127.0.0.1 api.mixpanel.com" >> 来阻止 Mixpanel API /etc/hosts' 在 OS X 上为我工作。这也适用于 Segment.io。
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.