第三方如何“跟踪 cookie"工作? [英] How do Third-Party "tracking cookies" work?

查看:29
本文介绍了第三方如何“跟踪 cookie"工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里阅读了这个问题:互联网广告商如何使用第三方 Cookie?关于第三方跟踪 cookie 的工作原理,但我仍然很困惑.我不明白如果我访问网站A(一个有广告的普通网站)网站B(一个广告网站)如何给我的电脑分配一个ID,然后弄清楚我在网站A上,然后其他网站有它的广告.

I have read this question here: How Do Internet Advertisers Use Third-Party Cookies? on how third-party tracking cookies work, but am still very confused. I don't understand how if I visit Website A (a normal website with ads) how Website B (an advertising website) can assign my computer an ID, and then figure out that I was on website A, and other websites after it that have its ads.

推荐答案

首先,cookie 是通过 HTTP 标头设置和检索的.如果您的浏览器向 http://example.com 发送请求,则响应可能会返回一个标有 Set-Cookie 的标头: foo=bar.您的浏览器会存储此 cookie,并且在对 http://example.com 的任何后续请求中,您的浏览器将发送 foo=barCookie 标头中的 code>.(或者至少在 cookie 过期或被删除之前.)浏览器将带有 any 请求的 foo=bar cookie 发送到 http://example.com,无论是谁发起请求或上下文是什么.如果 http://example2.com 包含标签 <img src="http://example.com/img.jpg">,那么浏览器在获取http://example时会发送cookiefoo=bar.com/img.jpg,即使 http://example2.com 负责发送的请求.

First, cookies are set and retrieved through HTTP headers. If your browser sends a request to http://example.com, then the response might come back with a header that says Set-Cookie: foo=bar. Your browser stores this cookie, and on any subsequent requests to http://example.com, your browser will send foo=bar in the Cookie header. (Or at least until the cookie expires or is deleted.) The browser sends the foo=bar cookie with any request to http://example.com, regardless of who initiated the request or what the context is. If http://example2.com contains the tag <img src="http://example.com/img.jpg">, then the browser will send the cookie foo=bar when it fetches http://example.com/img.jpg, even though http://example2.com is responsible for the request being sent.

因此,如果网站 A 包含由网站 B 提供的广告,则网站 B 可以在您的浏览器中设置 cookie.例如,也许网站 A 使用 <iframe src="http://websiteB.com/ad.html></iframe> 来投放来自网站 B 的广告.然后当您的浏览器转到要获取 http://websiteB.com/ad.html,响应将返回一个 Set-Cookie 标头,该标头设置了具有一些唯一随机字符串的 cookie.如果网站 C 还包含来自网站 B 的广告,那么当从网站 B 获取网站 C 上的广告时,将发送该唯一 cookie.

So, if website A contains an ad that is served by website B, then website B can set a cookie in your browser. For example, maybe website A uses <iframe src="http://websiteB.com/ad.html></iframe> to serve the ad from website B. Then when your browser goes to fetch http://websiteB.com/ad.html, the response will come back with a Set-Cookie header that sets a cookie with some unique random string. If website C also includes an ad from website B, then that unique cookie will be sent when the ad on website C is fetched from website B.

至于网站 B 如何知道您正在访问的实际网站,有多种方式.在某些情况下,当浏览器向一个网站发送请求时,它会告诉该网站您来自哪个网站.因此,当浏览器去获取 http://websiteB.com/ad.html 时,它可能包含 HTTP 标头 Referer: http://websiteA.com网站 B 发现请求是由网站 A 发起的.每次网站 B 看到它分配给您的唯一随机字符串时,它都会检查 Referer 标头以将您去过的地方添加到它的日志中.如果网站 A 与网站 B 合作,则 A 可以直接告诉 B 您来自网站 A.例如,网站 A 可以使用 <iframe src="http://websiteB.com/ad.html?referer=websiteA.com">,然后网站B就会在查询字符串中看到referer.

As far as how website B knows which actual website you're visiting, there are a variety of ways. In some cases, when the browser sends a request to one website, it tells the website which website you're coming from. So when the browser goes to fetch http://websiteB.com/ad.html, it might include the HTTP header Referer: http://websiteA.com that tells website B that the request was initiated by website A. Every time website B sees the unique random string that it assigned to you, it can check the Referer header to add to its log of where you've been. If website A is cooperating with website B, A can just directly tell B that you're coming from website A. For example, website A could include the ad from website B by using <iframe src="http://websiteB.com/ad.html?referer=websiteA.com">, and then website B will see the referer in the query string.

这有帮助吗?您链接的答案中是否有对您没有意义的特定部分?

Does that help? Are there particular parts of the answer you linked that don't make sense to you?

这篇关于第三方如何“跟踪 cookie"工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆