You saw a relevant ad in a random website, how did that happen?

Let’s say you search for Maggi(noodle packet) on amazon. Then 5 days later you visit some random WordPress blog. You see amazon Maggi ad there. How this works is a really interesting thing I learned at my previous workplace.

In simple terms, here is how it works:

Amazon wants to show Maggi ad for users who searched for “Maggi” on their site. It is generally called, “re-targetting campaign”.
1. Amazon marketing person calls an online ad company (say) “Ad Norton”.
2. Ad Norton sales person sets up a 30-day ad-job and calls it “amazon-maggi”, that job spits out a tracking URL. Ad Norton sales person gives that tracking URL to amazon sales person.

That URL may look something like this:"

3. Amazon sales person goes to Amazon engineering team, asked them to embed that URL in such a way that it will fire up when a user searches for “Maggi” or “maggi”. The URL should fire in the background, user should not notice the URL firing.
4. Amazon sales person tells Ad Norton sales person that the tracking URL is now put in place.
Ad Norton sales person starts the job.
This job runs for 30 days.

Fact about cookies:
When you visit a website say, not only is editing your cookies; many 3rd-party tracking URLs “fired-up” can also modify your cookies. But, your cookie is divided into “cookie spaces” only can modify cookie space, can not modify’s cookie space, vise versa.

Take a look at cookie space on a chrome browser

Explanation for URL from above

Notice that URL domain is, so this gives Ad Norton the ability to make changes in your Ad Norton cookie space.
Notice the job name is amazon-maggi
Notice that userid=adnorton-user-id that is YOU!
Ad Norton assigned that user id to you long time ago when they served an ad for you on some random website, they got that information now from your “ cookie space”
If you bought a brand new computer or installed a new browser, or cleared your cookies, then ad norton does not know you. So a new user id will be generated for you on the fly and put into your cookie space.

2 days passes by…

The owner of a website called “” became poor and wanted to make some money out of the advertisement. So he gave up his site’s upper right corner section (width 300pixels and height 250pixels) to a popular online ad company called “”. shows relevant ads at and pays the guy every month a share.

You visit amazon and search for “maggi”

fired from your browser.
Now servers across the globe know that ad-norton-userid 123456789 searched for “maggi” on amazon. But they don’t know your name, sexual orientation, etc

3 days passes by…

You were browsing random stuff on the internet.
You visit
they show you a Maggi picture on upper right corner (300x250) with URL of particular Maggi variant that is not selling well. Because adnorton knows you searched for it, also adnorton is still running that ad-job amazon gave them!
You click the Ad, and buy it.

10 years later

you die