javascript - Mixpanel 退出页面背后的实现细节

标签 javascript cookies tracking mixpanel

Mixpanel 的退出页面背后的实现细节是什么?

背景

Mixpanel 在 https://mixpanel.com/optout/ 有一个选择退出页面.一旦您提交“是的,我想选择退出。”,您应该不会在任何利用 Mixpanel 的网站上被跟踪。

在选择退出页面上,“mp_optout”cookie 设置为“1”。

    $(document).ready(function() {
        if (mp.cookie.exists('mp_optout')) {
            $('#optout').prop('checked', true);
        }

        $('#save_button').click(function() {
            $('#saved_text').show();
            if ($('#optout').prop('checked')) {
                mp.cookie.set('mp_optout', 1, 9999, true);
            } else {
                mp.cookie.remove('mp_optout', true);
            }
        });
    });

此设置最终如何与他们的 javascript 文件通信,https://cdn.mxpnl.com/libs/mixpanel-2.2.min.js , 绕过跟踪?

最佳答案

即使在选择退出 Mixpanel 后仍然会向服务器发出跟踪请求。您可以看到随这些请求一起发送的 mp_optout cookie:

Mixpanel network requests in Chrome developer tools

您可以通过从 URL 中删除“.min”来查看未缩小的 JavaScript 文件:https://cdn.mxpnl.com/libs/mixpanel-2.3.js

如果您搜索“optout”,您会找到此代码:

var req = new XMLHttpRequest();
req.open("GET", url, true);
// send the mp_optout cookie
// withCredentials cannot be modified until after calling .open on Android and Mobile Safari
req.withCredentials = true;

由于他们明确希望确保发送 mp_output cookie,因此他们可能在后端使用它来忽略请求并且不存储任何数据。

关于javascript - Mixpanel 退出页面背后的实现细节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26496882/

相关文章:

javascript - 如何跟踪 Google Adwords 的点击转化?

javascript - 拉维尔 : Bootstrap-datepicker-sandbox highlight specific date

javascript - D3嵌套和对象遍历

javascript - 如何停止循环 HTML5 视频并让它播放到最后

google-chrome - Ubuntu 重启后谷歌浏览器丢失 cookie

python - 如何清除scrapy中的cookies?

gps - 需要什么卡尔曼滤波器

javascript - 使用 v8 和过滤器/查找比较两个对象数组的高效方法

vue.js - vue-cli 前端未设置来自 Sanctum 的 CSRF cookie

flash - 是否可以跟踪横幅广告出现在哪些页面(或域)上?