javascript 如果我的浏览器禁用了 cookie,Google Analytics 会跟踪流量吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10084732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 08:38:07  来源:igfitidea点击:

Will Google Analytics track traffic if cookies are disabled in my browser?

javascriptgoogle-analytics

提问by Pratik Thakkar

I want to know whether Google Analytics will track traffic on my website, if my browser has cookies disabled?

如果我的浏览器禁用了 cookie,我想知道 Google Analytics 是否会跟踪我网站上的流量?

I tried to search on Google but couldn't find much information about this question.

我试图在谷歌上搜索,但找不到关于这个问题的太多信息。

I would appreciate if you can also provide me with a source link.

如果您也能给我提供一个源链接,我将不胜感激。

Thanks

谢谢

回答by Yahel

No, if you disable cookies, Google Analytics will not track you.

不,如果您禁用 cookie,Google Analytics 将不会跟踪您。

Google Analytics tracks you by creating cookies (or using existing cookies it finds). Then it uses that cookie information in the request it sends to http://google-analytics.com/__utm.gif. That "request" to get the __utm.gifis how the data is transmitted to Google Analytics.

Google Analytics 通过创建 cookie(或使用它找到的现有 cookie)来跟踪您。然后它在发送到的请求中使用该 cookie 信息http://google-analytics.com/__utm.gif。获取__utm.gif数据的“请求”是将数据传输到 Google Analytics 的方式。

Googling this is a bit difficult, since it mostly just turned up information on the cookies themselves, not what happens when they're disabled.

谷歌搜索这有点困难,因为它主要只是打开 cookie 本身的信息,而不是当它们被禁用时会发生什么。

So, I did an experiment to prove it. I loaded StackOverflow in a fresh FireFox install with cookies disabled.

所以,我做了一个实验来证明。我在禁用 cookie 的全新 FireFox 安装中加载了 StackOverflow。

Below is the list of HTTP requests. Note that it loads ga.js, the Google Analytics script that attempts to track you. But, no request for __utm.gifis made. ga.js merely runs, realizes its unable to create cookies, and as a result has no way to create "state" from pageview to pageview.

以下是 HTTP 请求列表。请注意,它会加载ga.js,即尝试跟踪您的 Google Analytics 脚本。但是,没有提出请求__utm.gif。ga.js 只是运行,意识到无法创建cookie,因此无法创建从pageview 到pageview 的“状态”。

enter image description here

在此处输入图片说明

Without cookies, Google Analytics would view every single "hit" as its own visit, and each of those visits would be a bounce. This data would be useless. As a result, GA makes the logical choice to just not track those people.

如果没有 cookie,Google Analytics 会将每一次“点击”视为自己的访问,而这些访问中的每一次都将是一次反弹。这些数据将毫无用处。因此,GA 做出了不跟踪这些人的合乎逻辑的选择。

回答by Shwaydogg

The answer appears to be YES, below is what google has to say.

答案似乎是肯定的,下面是谷歌所说的。

The "measurement protocol" can even work withOUT cookies or js, it seems to be in beta so you have to request access.

“测量协议”甚至可以在没有 cookie 或 js 的情况下工作,它似乎处于测试阶段,因此您必须请求访问。

Universal Analytics supports data collection without browser cookies. The Universal Analytics collection methods (analytics.jsand the Measurement Protocol) can be implemented and used to collect visitor usage data without cookies. These methods also work if cookies are cleared or disabled. Website visitors that don't want their visit data reported by Google Analytics can install the Google Analytics opt-out browser add-on to opt-out.

Universal Analytics 支持在没有浏览器 cookie 的情况下收集数据。可以实施Universal Analytics 收集方法(analytics.js测量协议)来收集访问者使用数据,而无需使用 cookie。如果 cookie 被清除或禁用,这些方法也有效。不希望 Google Analytics 报告其访问数据的网站访问者可以安装 Google Analytics 选择退出浏览器插件以选择退出。

Source: http://support.google.com/analytics/bin/answer.py?hl=en&answer=2838718

来源:http: //support.google.com/analytics/bin/answer.py?hl=zh-CN&answer=2838718

回答by Dave

Thanks for the explanation however I thougfht cookies or no cookies Analytics will still record a vist but just can't track it. So when you say "Google Analytics would view every single "hit" as its own visit, and each of those visits would be a bounce." are you implying this is still recorded as say a 0 second or 100% Bounce visit? Or Analytics records no visit at all?

感谢您的解释,但我认为 cookie 或没有 cookie 分析仍会记录访问,但无法跟踪它。因此,当您说“Google Analytics 会将每一次“命中”视为自己的访问,并且每次访问都将是一次反弹。” 你是说这仍然被记录为 0 秒或 100% 的反弹访问?或者 Analytics 根本没有记录任何访问?

回答by Michael

It can, but only if the site owner sets it up that way, which is difficult. The problem is tracking a user across different URLs while maintaining a UUID.

它可以,但前提是网站所有者以这种方式进行设置,这很困难。问题是在维护 UUID 的同时跨不同 URL 跟踪用户。

The short answer is yes - but only if the site owner found his way around the pitfalls.

简短的回答是肯定的 - 但前提是网站所有者找到了绕过陷阱的方法。

I did it on my website.

我是在我的网站上做的。