I was wondering how companies like Double-Click include a cookie in their image responses to track users. Similarly, how do the images (e.g. smart pixels) send information back to their servers?
Please provide a scripting example if possible (any language is okay) [note: if this is resolve doings something server side, please describe how this would be accomplished using APACHE].
Cheers,
Rob
To do this in php, you’d use the setCookie function.
That code was taken from the php doc I referenced above. Basically this adds the
Set-Cookieto the HttpResponse header like:Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1See http://en.wikipedia.org/wiki/List_of_HTTP_header_fields and search for
Set-CookieALSO, in scripting languages, like PHP, make sure you set the header before you render any content. This is because the HTTP Headers are the first thing sent in the response, so as soon as you write content, the headers should’ve already been written.
Another quote from the PHP:setcookie doc: