ADVERTISING / NOTEBOOK LESSON

47 · A01 · Ad products, participants, and transaction flows

Map ad products, participants, transaction forms, and their conflicting objectives.

Constructed mechanism / simulationRead-only · saved experiment

Saved outputs come from recorded teaching runs; opening this page does not rerun an experiment. The code and original outputs are preserved; original-language data and annotations may remain.

A01 · Ad products, participants, and transaction flows

Prerequisites: foundations 31–34; no ads-track prerequisite.

Evidence: explicitly constructed mechanism experiments, not real ad logs. This chapter does not claim industrial-system reproduction or online gains.

Learning order: predict → change one variable → run → explain.

English companion. All instructional Markdown is translated. Experiment code, Chinese language examples, execution counts, and saved outputs remain as in the source edition; historical output text may therefore be Chinese. The initial setup cell anchors the working directory and Python import path for this companion's deeper folder; it does not change the experiment. Saved outputs are historical evidence, not a new run. Run from the top after preparing the required data and models.

PYTHON · 01
# English companions live one directory deeper; keep the original experiment code unchanged.
from pathlib import Path as _TranslationPath
import os as _translation_os
import sys as _translation_sys
_translation_root = next((p for p in [_TranslationPath.cwd(), *_TranslationPath.cwd().parents]
                          if (p / "reclab").is_dir()), None)
if _translation_root is None:
    raise RuntimeError("Open this notebook from inside the Search Recommendation Ads Lab checkout.")
_translation_os.chdir(_translation_root)
if str(_translation_root) not in _translation_sys.path:
    _translation_sys.path.insert(0, str(_translation_root))

Problem and input/output contract

Advertising begins as a business activity. Advertisers seek brand or conversion value; publishers supply inventory and bear experience costs; users need relevant content without excessive disruption. Platforms coordinate eligibility, ranking, transactions, and feedback. Contracts pre-agree inventory and delivery obligations; auctions compete per request. Search describes the demand entry point, native describes presentation, and programmatic describes trading. These dimensions overlap. Advertising is more than CTR prediction.

Before running, predict which result the changed variable will affect and which invariants must hold.

PYTHON · 02
from pathlib import Path
import sys
root=Path.cwd()
if not (root/'reclab').exists(): root=root.parent
if str(root) not in sys.path: sys.path.insert(0,str(root))
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from reclab import ads_curriculum as ac

Run the one-variable comparison

Inputs are small constructed examples visible in source. Output units and constraints are defined above. Run assertions to verify mathematics and accounting.

PYTHON · 03
products=[{'product':'保量展示','allocation':'contract','billing':'CPM','risk':'欠投'},{'product':'搜索竞价','allocation':'auction','billing':'CPC','risk':'无关点击'},{'product':'程序化原生','allocation':'RTB','billing':'CPM','risk':'体验与隐私'}]
import pandas as pd
display(pd.DataFrame(products))
trace=ac.rtb()
print('请求 → 交易 → 反馈', trace['stages'])
Saved notebook output · not executed on this page
product allocation billing risk
0 保量展示 contract CPM 欠投
1 搜索竞价 auction CPC 无关点击
2 程序化原生 RTB CPM 体验与隐私
请求 → 交易 → 反馈 ['SSP request', 'ADX eligibility', 'DSP response', 'auction', 'win/loss notice', 'feedback']

Interpretation and limits

The same RTB request is supplied by a publisher/SSP, coordinated by an exchange, and bid on by DSPs representing demand. This is a constructed flow, with no ad-network request sent. Settlement events may occur after display; one click cannot fully identify brand value.

Inspect source, then try an exercise

Change sponsored search from auction delivery to guaranteed search impressions. Which eligibility and settlement rules remain, and which change? List one potentially conflicting metric for each of the three parties.

PYTHON · 04
import inspect
print(inspect.getsource(ac.rtb))
Saved notebook output · not executed on this page
def rtb(bid=1.2, competitor=1., reserve=.8, mechanism='second', timeout=False):
    if mechanism not in ('first','second'): raise ValueError('Invalid mechanism')
    win=not timeout and bid>=max(competitor,reserve)
    return dict(win=win, payment=(bid if mechanism=='first' else max(reserve,competitor)) if win else 0.,
                observed_market_price=competitor if win else None,
                lost_price_lower_bound=bid if not win and not timeout and bid>=reserve else None,
                stages=['SSP request','ADX eligibility','DSP response','auction','win/loss notice','feedback'])

Sources and next step

A-CCR pp. 3–5 and 14–32; product sections of the public A-LIU table of contents. This is an original Lab exercise, not a copy of the complete lecture text.

Chinese GitHub chapter · Authors’ RTB slides. The Chinese deck is not a complete modern advertising-engineering course. Historical descriptions of platforms are not presented as current market facts.

After the exercise, return to the ads learning path and continue to the next semantic unit.

GO TO THE SOURCE

Sources for this lesson

Completion marks are optional and stored only in this browser. Reading a page does not mark it complete.