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.
ベストアンサー1
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://2.example
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://2.example
is responsible for the request being sent.
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.example/ad.html></iframe>
to serve the ad from website B. Then when your browser goes to fetch http://websiteB.example/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 が、実際にユーザーがどのウェブサイトにアクセスしているかを知る方法については、さまざまな方法があります。場合によっては、ブラウザが 1 つのウェブサイトにリクエストを送信するときに、ユーザーがどのウェブサイトからアクセスしたかをそのウェブサイトに伝えます。そのため、ブラウザが を取得するときにhttp://websiteB.example/ad.html
、リクエストがウェブサイト A によって開始されたことをウェブサイト B に伝える HTTP ヘッダーを含めることがありますReferer: http://websiteA.example
。ウェブサイト B は、ユーザーに割り当てた一意のランダム文字列を確認するたびに、Referer ヘッダーをチェックして、ユーザーがアクセスした場所のログに追加することができます。ウェブサイト A がウェブサイト B と連携している場合、A はユーザーがウェブサイト A からアクセスしたことを B に直接伝えることができます。たとえば、ウェブサイト A は を使用してウェブサイト B からの広告を含めることができ<iframe src="http://websiteB.example/ad.html?referer=websiteA.example">
、ウェブサイト B はクエリ文字列でリファラーを確認します。