javascript - 为什么域在谷歌分析中被散列?

标签 javascript hash web google-analytics web-analytics

我正在使用 Google Analytics 构建自己的网络分析引用库, Open Web Analytics .

在 Google Analytics 中,域被散列并且该散列存储在 cookie 中.

我在 urchin tracker 中发现了类似的哈希技术:

    function(d) {
      if (!d || d == "") return 1;
      var h = 0,
      g = 0;
      for (var i = d.length - 1; i >= 0; i--) {
        var c = parseInt(d.charCodeAt(i));
        h = ((h << 6) & 0xfffffff) + c + (c << 14);
        if ((g = h & 0xfe00000) != 0) h = (h ^ (g >> 21));
      }
      return h;
    }

在谷歌分析中对域进行哈希处理是否有任何特定原因或仅供引用?

任何想法都会受到赞赏。

最佳答案

来自 _setAllowHash() 的文档:

The domain hashing functionality in Google Analytics creates a hash value from your domain, and uses this number to check cookie integrity for visitors.

请注意,_setAllowHash 已被弃用——我不知道这是否意味着 Google Analytics 不再使用域哈希进行 cookie 验证或其他...

关于javascript - 为什么域在谷歌分析中被散列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15564554/

相关文章:

javascript - .toFixed() 结果存在问题

javascript - 如何将 Golang 中的 [][]byte 发送到浏览器以将其解码为图像

javascript - 如何在 nextjs 上设置粒子背景?

javascript - 我无法从 SugarJS 格式化日期

javascript - 获取 anchor 元素的文本值

javascript - 如何创建分布在一定区间内的伪随机数数组?

ruby - 将关键字参数和参数与默认值混合会重复散列吗?

oracle - PL/SQL 中有散列函数吗?

php - javascript 和 php 中的功能相同,但输出不同

javascript - 访问被 CORS 策略阻止的 Web list