Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently, I read that Facebook ads are moving towards retargeting and got interested deeper into subject. Essentially, retargeting is technique advertisers use that tracks purchase intent by putting cookies into your browser and when you visit another website within ad network you will see ad for item you "wanted to buy".

In order this to for, both publisher and advertiser need to work together. Publisher needs add couple of lines of javascript and publisher need to be able to read this info across sites. In most cases, javascript inserts iframe from adnetwork domain. Iframe script sets cookies for both host domain and remote adnetwork domain.

However, Same Origin policy do not let iframes read/set content from parent domain. Is there something I'm missing here? Can someone explain how this technique actually works?

share|improve this question

closed as off topic by GlenH7, Walter, Caleb, Robert Harvey, Dynamic Oct 15 '12 at 19:12

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

The javascript already calls the advertising company (through httpxml requests I guess) to serve the ads. No reason it can't also call that company to post data to their servers about where and who it's calling from (in fact they've been doing that for a long time, that's how Google amasses their gigabytes of data about your browsing behaviour).
The calculations are all done on the server, not the browser. All the browser does is send the extra information to the server of the advertising agency, together with the ip address and whatever else it can fish out of your computer (usernames, passwords, who knows what).

share|improve this answer
thanks for answer. I wonder how ad network recognize user on another website within ad network. Iframe can't set cookie for adnetwork domain, but only cookie for current domain. On the other hand, Same origin policy to not let iframe read cookies from another domain. – Bojan Babic Oct 15 '12 at 23:03
as I said, that information is stored serverside, not clientside. On loading the page, using javascript data is sent to the server where it is matched with data gathered previously from the same client on other sites/pages, and tailored ads are returned to the client for rendering. – jwenting Oct 16 '12 at 12:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.