You look at a pair of boots in an online shop, close the tab, and an hour later the same boots sit in a banner on a news site. The question of how does retargeting work has a short answer: the shop left a marker in your browser, and other sites asked an ad exchange what that marker was worth. Every step depends on something remembering you between one site and the next.
Not every ad works that way. vlvd ads, for one, shows ads that carry no cookie and no visitor id, so there is nothing for a later ad to follow. The contrast makes the machinery of retargeting easier to see.
How does retargeting work, step by step
Behavioral retargeting is a kind of targeted advertising aimed at you because of what you did online before. It runs in three steps.
- Tagging. A page you visit carries a tiny image or script, usually called a pixel, that sets a cookie in your browser. The cookie holds an id that stands for you.
- Matching. Later, a different website has an empty ad slot. When the slot loads, the cookie id travels with the request to an ad exchange.
- Showing. The exchange sees an id the shop has tagged, and the shop's ad wins the slot. The banner you see is picked for the id, not for the page you are reading.
Nothing in those steps needs your name. The id is enough, because it stays the same from site to site for as long as the cookie lives.

The pixel and the cookie behind it
A cookie is normally sent back only to the server that set it. The trick is that a page is built from many parts, and some of them come from other servers. Third-party cookies are the ones set while your browser fetches those outside parts, such as an image from an ad company's domain. Because the same ad company's parts appear on many pages, its cookie comes back to it from all of them, and visits on many websites can be tied to one id.
The pixel is the outside part that does the tagging. It is often a single image too small to see, loaded from the ad company's server. Loading it is enough to set or read the cookie. A tracking pixel can also report which page it sat on, which is how the ad company knows you looked at boots rather than socks.
The cookie keeps the id and the pixel sets and reads it. Take either one away and the chain breaks. That is why the long argument over third-party cookies matters so much to retargeting: the Wikipedia page on third-party cookies notes that the major browser makers planned to phase them out, and that Google reversed the plan for Chrome in July 2024.
Where the auction comes in
The matching step usually happens inside an auction. With real-time bidding, ad space is sold one impression at a time: each time a page loads an ad slot, advertisers bid in an instant automated auction, and the winner's ad appears on the spot.
Retargeting changes what a bidder knows during that auction. A bidder with no history on you sees only the page and the slot. The shop that tagged you sees an id it recognizes, one that recently looked at boots. That makes the impression worth more to the shop than to anyone else, so the shop tends to bid higher and win. The result feels personal because the auction was decided by your history.
A worked example: one pair of boots, three websites
Here is an invented case, step by step, using only the pixel, the cookie and the auction.
- Monday, 10:00, the shop. You open a page for brown hiking boots. The page loads a pixel from an ad company's domain. Your browser has no cookie from that domain yet, so the company sets one with the id 7Q2. It also records that 7Q2 viewed the brown boots.
- Monday, 10:04, you leave. You put the boots in the basket, hesitate and close the tab. The order is started but not finished.
- Monday, 11:30, a news site. You read an article. Its ad slot loads from the same ad company, and your browser sends the cookie with id 7Q2 along with the request. The auction runs. The shop has asked to reach anyone tagged as viewing those boots, so it bids, wins, and a banner of the brown boots appears.
- Tuesday, a recipe site. The same thing happens again. This time the banner is built on the fly from the pages you viewed, a method the Wikipedia page calls dynamic creative, and its link drops you back into the unfinished order.
Now remove one piece. If your browser had refused the ad company's cookie at step 1, the news site's request at step 3 would carry no id. The auction would see a reader of a news article and nothing else. The boots would not follow you, because nothing connected Monday morning to Monday afternoon.
The kinds of retargeting
The Wikipedia page lists several forms, and all of them depend on setting a cookie in your browser.
- Site retargeting tags people who visited a site, the case in the boots example.
- Search retargeting tags people by what they searched for, even on sites they never visited.
- Email retargeting places the pixel inside an email, so opening it tags the reader.
- Link retargeting tags people who clicked a shared link.
- Social retargeting shows the ads inside social networks.
The common thread is the order of events. First something learns about you, then an ad is chosen because of what it learned. The ad is the last step of a chain of memory, never the first.
Ads that carry no memory of you
The opposite design starts from the page instead of the person. The ad service named at the start works this way: a site tells it only the site's own name, the kind of ad and which ads were already shown during the visit, and the browser keeps that short list only until the tab closes, so the same ad is not shown twice. There is no cookie and no visitor id.
Two more choices close the remaining gaps. Every ad, its picture included, loads from the service's own domain, so an advertiser's server never receives a request from the viewer and never sees who looked. And the counts kept are views and clicks per ad, per site, per day: numbers only. A person checks each ad before it runs.
Run the boots example through that design. At step 1 nothing is set in your browser. At step 3 the ad slot carries a site name and a kind of ad. There is no id to bid on, so no ad can be chosen because of Monday morning. Retargeting is not switched off there; it simply has nothing to work with.
Frequently asked questions
Is retargeting the same as remarketing?
Mostly, yes. The Wikipedia page treats behavioral remarketing as another name for behavioral retargeting.
Why do ads keep showing something already bought?
The cookie records that you viewed the item, and the ad company may not learn that the order was finished. Until that news reaches it, your id still reads as a likely customer.
Can you stop retargeted ads?
Blocking third-party cookies in your browser settings removes the shared id most retargeting relies on. Clearing cookies also resets any id already set, though a new one can be set on your next visit.
Does retargeting need your name or email?
No. A cookie id is enough to follow one browser from site to site. Email retargeting is the exception, since the pixel sits in a message sent to a known address.
Why retargeting depends on memory
Every form of retargeting rests on one fact: some server remembers your browser between one page and the next. The pixel writes the memory, the cookie keeps it, and the auction reads it at the moment an ad slot loads. That is also its weak point. When the browser keeps nothing that a third party can read, the chain has no first link, and an ad can be matched only to the page in front of you. Whether the boots follow you is decided long before the banner appears, at the moment your browser agrees to remember.