Post

Introduction to AdTech: The Millisecond Handshake - Ad Tags, Pixels and the Redirect Loop

Introduction to AdTech: The Millisecond Handshake - Ad Tags, Pixels and the Redirect Loop

In the previous posts, we explored who participates in the AdTech ecosystem and how the supply and demand stacks are structured. In this post, we shift focus to how those systems actually talk to each other in real time.

This article breaks down the low-level mechanics that make digital advertising possible: Ad Tags, Redirects between ad servers, and Tracking Pixels. Together, these form the millisecond-level handshake that allows a browser to coordinate multiple globally distributed systems - publishers, advertisers, and measurement platforms, before a single ad slot finishes rendering.

Understanding this “plumbing” is critical because:

  • It explains how trust is enforced between publishers and advertisers.
  • It shows why browsers sit at the center of the entire system.
  • It reveals how delivery, measurement and attribution are decoupled by design.

Once these mechanics are clear, the more advanced topics - like bidding strategies, user identity, and machine-learning-driven optimization become much easier to reason about. This post provides the foundation for everything that follows.


1. The Ad Tag: The Browser’s Instruction Manual

An ad tag is not the ad itself. It is a snippet of code (usually JavaScript) that acts as a set of instructions for the user’s browser. Think of it as a recipe that tells the browser exactly where to go and what to do to fetch the actual ad.

The Scenario

  • Who: Priya, a user in Bengaluru.
  • Where: She navigates to ESPNCricinfo.com to check the latest scores on Women’s World Cup cricket tournament.
  • The Goal: Nike wants to show Priya their new Indian Cricket Team jersey.

The Step-by-Step Journey

  1. The Encounter: As Priya’s browser downloads the HTML source code, it finds a <script> tag embedded in a <div> for the main banner slot :
1
2
3
4
5
6
7
8
<div id='homepage-top-banner'>
  <script>
    googletag.cmd.push(function() {
      googletag.display('homepage-top-banner');
    });
  </script>
</div>

  1. The Instruction: The googletag.display(...) function tells the browser to stop what it’s doing and fetch an ad for that specific slot.

  2. The First Call: This triggers a network request to the Publisher’s Ad Server (e.g., Google Ad Manager). This request carries critical metadata: the Ad Unit ID, the Website URL, Priya’s IP address (location), and her browser type.

At this point, the browser knows which slot needs an ad - but not yet where the ad will ultimately come from.


2. The Redirect Loop: Passing the Baton

One of the most fundamental concepts in AdTech is the Dual-Server System. To ensure trust and independent measurement, the publisher and advertiser each use their own ad servers. This separation ensures neither side has to blindly trust the other’s numbers - each independently observes the same event.

  1. The Decision: The Publisher’s Ad Server (1st Party) receives the request and decides that Nike’s campaign is the best match for Priya.

  2. The Redirect: Crucially, the Publisher Server does not send the Nike image directly to Priya’s browser. Instead, it sends back another piece of code - Nike’s own ad tag. This is not an HTTP redirect in the traditional sense, but a logical redirect that instructs the browser to make the next call itself.

  3. The Second Call: Priya’s browser receives this redirect and makes a second network request, this time to Nike’s ad server (e.g., Campaign Manager 360).

  4. Independent Verification: This second call allows Nike to independently log that an impression is about to be served. Nike’s server checks its internal rules (like Frequency Capping, e.g. “don’t show this to Priya more than 3 times today”) and finally delivers the creative file (Nike_Jersey_Ad.jpg).

  5. The Render: The browser receives the image and renders it inside the banner <div>.

Delivering an ad is only half the story. The system also needs to know whether that delivery actually mattered.


3. The Tracking Pixel: Closing the Feedback Loop

While the Ad Tag is about Delivery (the “For Rent” sign in the window), the Tracking Pixel is about Measurement (the invisible security camera counting how many people entered the store). They are two sides of the same coin, marking the beginning and end of a user’s advertising journey.

The Mechanism

A tracking pixel is a tiny, invisible 1x1 pixel image placed on pages that signify an event, such as a “Thank You” or “Order Confirmed” page. It acts as an invisible tripwire.

  1. Awareness (Ad Tag): A user in Bengaluru is Browsing ESPNCricinfo.com. An ad tag fires and delivers an ad of a Nike jersey for Indian Women’s Cricket Team.
  2. Consideration (Pixel): The user clicks the ad and browses the jersey product page on Nike’s website. A ViewContent tracking pixel fires, telling Nike’s ad platform that the user is interested.
  3. Conversion (Pixel): The user buys the jersey. She lands on the “Order Confirmed” page. A Purchase tracking pixel fires, telling the ad platform that the ad campaign has successfully generated a sale.

In short: the ad tag delivers the message, and the tracking pixel reports back on whether the message was successful.

Example: The Purchase Confirmation

When Priya buys the jersey, the browser tries to load a simple <img> tag from the advertiser’s server:

1
2
<img height="1" width="1" style="display:none;"
src="https://tracking.nike.com/pixel?event=Purchase&value=2499.00&currency=INR" />

What happens technically:

  • The browser makes a simple GET request to the URL in the src attribute.
  • The server (e.g. tracking.nike.com) reads the parameters: event=Purchase and value=2499.00.
  • The server logs this event and ties it back to the specific user who originally clicked the ad.
  • The server sends back the invisible 1x1 image to complete the request.

The high level flow now looks something like this:

1
2
3
4
5
Browser
  → Publisher Ad Server
    → Advertiser Ad Server
      → Creative
        → Pixel fires

Redirects and pixels may look archaic, but they survive because they are stateless, scalable, and browser-native.


4. Cookies: Tying the Thread Across Time and Space

So far, everything we’ve described happens within a single page load. But advertising doesn’t care only about this moment - it cares about history.

To connect the Awareness event (an ad tag firing on Site A today) with the Conversion event (a tracking pixel firing on Site B tomorrow), the system needs a way to recognize that the same browser was involved in both.

This is where cookies enter the picture.

What Problem Cookies Actually Solve

At a technical level, cookies answer one simple question:

“Have I seen this browser before?”

They provide a persistent, browser-scoped identifier that survives:

  • page refreshes
  • navigation across websites
  • and time gaps between sessions.

Without cookies, every ad impression and pixel fire would look like a brand-new, unrelated event.

How Cookies Fit into the Flow We’ve Already Seen

Let’s extend Priya’s journey:

  1. Day 1 - Awareness

    Priya visits ESPNCricinfo.com. When Nike’s ad tag is executed via the redirect loop, Nike’s ad server responds with:

    • the ad creative, and
    • a small instruction to store a cookie in Priya’s browser (e.g., nike_id=abc123).

    From this point on, Nike can recognize this browser whenever it encounters that cookie again.

  2. Day 3 - Conversion

    Priya visits Nike’s website directly and buys the jersey. On the confirmation page, the tracking pixel fires. Along with the Purchase event, the browser automatically sends all cookies belonging to nike.com, including nike_id=abc123.

    Nike’s system can now connect:

    “The browser that saw the ad on ESPNCricinfo is the same browser that just purchased.”

That connection is the backbone of attribution, optimization, and learning.

First-party vs Third-party Cookies

Cookies themselves are not an AdTech invention - they’re a general browser storage mechanism. What matters is who sets them and where they can be read.

  • First-party cookies
    • Set by the site you are visiting (e.g., nike.com).
    • Only readable by that same domain.
    • Used for logins, carts, preferences - and increasingly, ad measurement.
    • Example: Nike recognizing Priya when she returns to nike.com.
  • Third-party cookies
    • Set by a different domain embedded on a site (e.g., facebook.com setting a cookie while you’re on ESPNCricinfo.com).
    • Historically allowed ad platforms to recognize the same browser across many publishers.
    • Enabled cross-site frequency capping, audience building, and retargeting.

In both cases, the browser enforces strict boundaries: cookies live in domain-specific “jars” and are automatically attached only when requests match that domain.

Why Cookies Matter to the Broader AdTech Ecosystem

Cookies are the glue that allows the rest of the system to function coherently:

  • Measurement: Did the ad lead to an outcome?
  • Frequency capping: Have we already shown this ad too many times?
  • Optimization: Which impressions actually convert?
  • Learning: What kinds of users respond to what messages?

Without some form of persistent identifier, ad tags and pixels would still fire - but they would be stateless signals, impossible to tie together into a meaningful story.

A Note on Evolution

Modern browsers are increasingly restricting third-party cookies, pushing the industry toward:

  • first-party identifiers
  • server-side signals
  • and privacy-preserving alternatives.

But regardless of how identity is implemented, the underlying requirement remains the same:

The system needs a way to recognize the same browser across time and context.

Cookies were simply the first scalable solution to that problem.


Conclusion & Continuity

We’ve now covered the “plumbing” that enables the digital ad. The browser acts as the ultimate orchestrator, jumping between globally distributed servers to fetch assets and fire off tracking signals in less than 200 milliseconds. Notably, none of this coordination happens through a central controller - the browser itself stitches the system together.

But how do these servers decide which ad is worth bidding on in the first place? In the next article, we move into the Intelligence Layer, exploring the Machine Learning problems that power Bid Optimization, Pacing, Fraud Detection and other interesting problems.

Enjoyed this article? Never miss out on future posts - follow me.
This post is licensed under CC BY 4.0 by the author.