1

I did a quick search on "third party cookies". As far as I know, a cookie can only be sent back to it's own domain (and path) by the browser via the HTTP request.

For example, I'm visiting the website A who contains an image from an advertising website B. My browser sees the url of the image and makes a HTTP request for that image to the website B. The website B get that HTTP request and set cookies in the HTTP response "Set-Cookie: user=arandomstring". There my browser now contains cookies from the website A and a cookie named "user" from the website B. The next time when I go to another website C who also contains an image from the same advertising website B, the website B would only get the "user" cookie set by himself. am I right? How can website B knows which websites (website A) have I visited in order to display his customized adverts?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Kewei Shang
  • 949
  • 3
  • 11
  • 27
  • 1
    possible duplicate of [How do Third-Party "tracking cookies" work?](http://stackoverflow.com/questions/13897472/how-do-third-party-tracking-cookies-work) – Mogsdad Sep 17 '15 at 02:53

1 Answers1

1

The easiest and most common way is to pass information about the site the request was made for as a parameter, e.g. <img src="http://server-b.com/img.jpg?server=A">

Another solution is to get this information from the "Referer" header. However, this method will not work for every visitor since this header can be disabled in most browsers.

Niko
  • 26,516
  • 9
  • 93
  • 110