Skip to content

Advertisers & publishers

Respected, and always clearly marked.

Agents still see your sponsors, in their own labelled block. Never inside the content, never inside an AI answer.

Ads pay for much of the web, so the module relays them to agents rather than stripping them out, and always keeps them apart from content.

Ads on the page. These are recognised by markup:

  • containers whose class, id, aria-label or data-ad-* attributes say ad, advert, sponsored, promoted or adsbygoogle (matched as whole words, so add-to-cart or header never match),
  • rel="sponsored" links.

They are taken out of the page text, kept out of learning and out of the AI's context, and delivered in a separate block. Inline sponsored links stay in the text, marked "(sponsored link)". Ad slots that scripts fill in a browser contain nothing on the server, so they are skipped.

Agent ads you configure. These are needed because script-loaded ads don't exist server-side:

apache
AIAgentAd "SeaCo" "Charter a sailing boat in Montpellier, 20% off." "https://seaco.example/charter" "/shop/ sailing boat"
AIAgentAdsFile /etc/apache2/agent-ads.json   # [{"advertiser","text","url","paths":[...],"keywords":[...],"weight":1}]
AIAgentAdsMax 2
AIAgentAdsRequired On                        # ask agents to show the ads in return for access to the content

Targeting tokens starting with / are path prefixes; the others are keywords, matched against the page title or the agent's question. Ads without targeting are shown anywhere, and weighted rotation spreads impressions.

Where ads appear:

  • Chat turns, page guides, answers and MCP results carry a "sponsored" object: {"notice": "...", "show_to_user": "requested by the site" | "optional", "items": [{"label": "Sponsored", "advertiser", "text", "link", "destination"}]}. The notice tells agents to label ads clearly, keep them separate, leave them unchanged, and never present them as the site's answer or their own recommendation.
  • Markdown views end with a quoted Sponsored block.
  • The AI is instructed never to put ads in its answers.

Measurement. Impressions and clicks are logged to ads.log (time, ad, where, page, agent). Click links (/.well-known/ai/ad/<id>) count the click, then redirect, only to the configured destination (never an open redirect).