Sub topic 1
How third-party cookies power targeting and measurement
Prerequisites
This chapter assumes you know the following:
- Basic digital marketing terms: campaign, impression, click, conversion, funnel.
- What a tag manager does and how a tracking tag loads on a page.
- That a cookie is a small piece of data a browser stores for a website.
You do not need to write code. The examples are short and show the mechanism.
What makes a cookie "third-party"
A cookie belongs to a domain. The browser sends it back to that domain on later requests. Whether it is first-party or third-party depends on how the domain relates to the page the visitor is on.
- A first-party cookie is set by the domain in the address bar. If a visitor is on
shop.example, a cookie fromshop.exampleis first-party. - A third-party cookie is set by a different domain whose content is loaded into the page. If
shop.exampleembeds a pixel or script fromadnetwork.example, a cookie fromadnetwork.exampleis third-party.
The cookie is the same kind of object in both cases. Only the relationship between the cookie's domain and the page differs. The browser decides this on each request.
A third-party cookie lets one company recognize the same browser on many unrelated sites. That is the property advertising technology relied on. The visitor never has to visit the ad company directly. Any site that embeds the company's code becomes a place where the browser can be recognized.
How cross-site recognition works
The mechanism has three steps.
- A visitor opens a page that embeds a resource from an ad platform, such as a pixel, a script or an ad slot.
- The browser requests that resource from the platform's domain. If the platform has not seen this browser before, its response sets a cookie containing a random identifier.
- On every later page that embeds the same platform, the browser sends the cookie back with the request. The platform now knows that the browser that saw ad slot A on one site is the same browser loading a pixel on another site.
The identifier is usually a random string, not a name. The platform links behavior to that string and builds a profile around it. Nothing in the cookie says who the person is. The profile describes a browser.
A simplified version of the response that sets such a cookie looks like this:
Set-Cookie: uid=abc123; Max-Age=7776000; Path=/; Secure; SameSite=NoneSameSite=None is the attribute that allows the cookie to be sent in cross-site contexts, and Secure is required alongside it. Browsers that block third-party cookies ignore or reject cookies set this way in cross-site contexts. That is the technical core of the changes covered in later chapters.
What the cookie enabled for targeting
Once a platform can recognize a browser across sites, several targeting techniques become possible.
Behavioral and interest targeting
The platform records which pages and topics a browser interacts with, then assigns it to segments such as "in-market for running shoes". Advertisers buy those segments on sites that have no relationship with the topic.
Retargeting
A retargeting setup puts an advertiser pixel on its own site. When a visitor views a product, the pixel records that the browser identifier viewed it. The advertiser's ad platform then shows that product on other sites the same browser visits. This requires the identifier to be the same on the advertiser's site and on the publisher sites where the ad appears. A third-party cookie provides that match.
Lookalike and audience expansion
Platforms compare the profiles of known converters with other browsers and find browsers that behave similarly. This depends on having many cross-site behavioral signals per browser.
Frequency capping
An advertiser can limit how often one person sees an ad. This works only if every impression, across all sites and exchanges, can be counted against one identifier. Without a shared identifier, each site counts separately and the same person can see an ad many times.
What the cookie enabled for measurement
Measurement used the same recognition in the opposite direction. Targeting uses past behavior to choose who sees an ad. Measurement uses the identifier to connect an ad exposure to a later action.
Click-based attribution
When a visitor clicks an ad, the landing URL often carries a click identifier or campaign parameters. A tag on the site stores them in a cookie and reads them again at conversion. This usually works with first-party storage, so it is the most durable form of attribution.
The following URL shows campaign parameters. They are a first-party way to record the source, but they cannot connect separate visits to a single person without other data.
https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_saleView-through attribution
A person sees an ad but does not click. Later the person converts on the advertiser's site. To credit the ad, the platform needs to know the browser that saw the impression is the browser that converted. The platform's cookie, present on both the publisher page and the advertiser page, makes that match possible. Without it, view-through conversions cannot be counted this way.
Cross-site and cross-device journeys
Multi-touch attribution models assemble a path of touchpoints per identifier: a display ad, a search click, an email, a purchase. The quality of the path depends on how many touchpoints share an identifier. Third-party cookies provided a common key across sites, but only within one browser on one device. A person who saw an ad on a phone and bought on a laptop was already two separate identifiers unless the person was logged in.
Reach and frequency reporting
Platforms reported how many unique people saw a campaign. They counted unique cookie identifiers. This number was always an approximation, because one person can have several browsers and devices and one browser can be shared.
Where the signal was always weak
The cookie model was never as precise as dashboards suggested. Knowing this helps you judge what you actually lose later.
- Cookies identify browsers, not people. Shared devices merge people. Multiple devices split one person.
- Users clear cookies. Some browsers cap lifetimes, so identifiers disappear and a returning visitor looks new.
- Consent and ad blockers already prevented some pixels from loading, so counts were incomplete.
- Cookie syncing, where platforms exchange identifiers so they can match each other's records, lost matches at every exchange. Match rates between platforms were often well below 100%.
A worked example
A shop runs three activities for one shopper, Sam, over two weeks.
- Sam reads a blog on
newsblog.example, which shows a display ad for the shop. Sam does not click. The ad platform's cookieuid=abc123is set. - Sam later visits
shop.examplethrough an organic search. The ad platform's pixel on the shop reads the sameuid=abc123. Sam views a pair of shoes and leaves. - Over the following days, Sam sees the shoes in ads on three other sites. Each time the platform recognizes
uid=abc123. - Sam buys. The platform matches the purchase to
uid=abc123and reports a view-through conversion for the display ad.
Now remove the third-party cookie. In step 1, the platform cannot link the blog visit to the shop visit. In step 3, the platform has no shared identifier for the other sites, so retargeting fails or relies on a different signal. In step 4, the purchase may be reported only through whatever first-party or modeled signal remains. The same shopper behavior, but the advertiser sees less of it.
The lines below show a simple way to see the dependency on matching. They compute how many conversions a platform can attribute when only a share of impressions can be matched to a conversion.
def attributed_conversions(true_conversions, match_rate):
"""Conversions the platform can credit when only match_rate of exposed users can be linked."""
return round(true_conversions * match_rate)
for rate in (0.9, 0.6, 0.3):
print(rate, attributed_conversions(1000, rate))With 1000 true conversions, a 90% match rate credits 900, a 60% rate credits 600 and a 30% rate credits 300. The conversions still happened. The measurement system just cannot connect them to the ad.
Common mistakes
- Treating "first-party" as meaning "exempt from rules". A first-party cookie still needs consent where the law requires it, and browsers may limit how long a script-set cookie lasts.
- Assuming that all cookie-based measurement is third-party. Click attribution, site analytics and on-site conversion tracking mostly use first-party storage.
- Assuming a cookie identifies a person. It identifies a browser profile on one device.
- Reading platform-reported reach and view-through numbers as exact counts.
Where this leads
The cookie gave advertisers one shared key across sites. Targeting, frequency capping, retargeting and view-through attribution all depend on that key. When it is blocked, each of these fails in a different way and to a different degree. The next chapters cover why browsers block it and which parts of your stack are affected.
Exercise
A shopper sees your display ad on a news site, does not click, and buys from your site two days later in the same browser. Explain why a third-party cookie was needed to credit the ad as a view-through conversion, and name one reason the reported number could still be wrong.
Show answer
The ad platform's cookie was set when the impression was served on the news site and was sent again when the platform's pixel loaded on your site. That shared identifier is what let the platform say the browser that saw the ad is the browser that bought. Without it, the two visits cannot be linked. The number could still be wrong because a cookie identifies a browser, not a person. If the shopper saw the ad on a phone and bought on a laptop, the match fails and the conversion is missed. Cleared cookies, ad blockers and imperfect cookie syncing also cause missed or false matches.
Exercise
Why does frequency capping stop working across sites when third-party cookies are blocked, even though each individual site can still count its own impressions?
Show answer
Capping needs one identifier that follows the person across every site and exchange so that all impressions are counted together. When the shared cookie is blocked, each site counts only what it sees under its own identifier. The same person can then reach the cap on each site separately and see the ad far more times in total than you intended.