Network Architecture & Clearance Loop
Trade Impression operates a distributed programmatic clearinghouse engineered exclusively for developer-facing software, technical SaaS, and AI agent workflows.
Context Signal
Publisher app passes slot, publisher_id, and optional contextual keywords (e.g. legal_saas, postgres).
Edge Auction
Cloudflare Edge worker executes contextual bandit routing against active campaigns in <14ms. Empty fill returns fill: false.
Native Injection
Creative renders inside host DOM with zero iframe delay, inherits host CSS fonts, and binds FTC-mandated "Sponsored" badge.
MRC Clearing
After 1.0s continuous 50% viewport dwell, verified impression beacon executes. Clearinghouse credits publisher barter ledger or cash reserve.
5-Minute Automated Quickstart
Choose between the interactive terminal CLI, the AI coding agent Stdio MCP protocol, or automated GitHub pull request generation.
# Run the automated repository detector in your project root:
npx @tradeimpression/setup --publisher pub_termscore --slot sidebar --context legal_saas --yes
# The CLI will:
# 1. Detect Next.js, Vite, Remix, or static HTML
# 2. Install @tradeimpression/react or inject <ti-placement>
# 3. Create your component file (e.g. components/NetworkPlacement.tsx)
# 4. Perform a pre-flight test against https://tradeimpression.com/v1/placementClient SDK & Component Pathways
Select your target stack. Every package automatically wraps MRC 1.0s dwell observation, click delegation, and zero-CLS height collapse.
// 1. Install packages
npm install @tradeimpression/react @tradeimpression/sdk
// 2. Mount component inside your layout or page shell
'use client';
import { TiPlacement } from '@tradeimpression/react';
export function SidebarPlacement() {
return (
<TiPlacement
publisherId="pub_termscore"
slot="sidebar"
appContext="legal_saas"
className="my-4 rounded-lg border border-stone-200"
/>
);
}| Property / Attribute | Type | Required | Description |
|---|---|---|---|
| publisherId / publisher-id | string | Yes | Your registered publisher key (e.g. pub_termscore). |
| slot | string | Yes | Approved slot identifier: sidebar, post_result, below_response, inline_tool, agent_turn. |
| appContext / app-context | string | Optional | Contextual taxonomy tags to boost clearing CPM (e.g. legal_saas, devtools). |
| messages | ConversationMessage[] | For chat | Passed to <ConversationPlacement> for real-time contextual relevancy scoring. |
| onFill | (fill: boolean) => void | Optional | Callback fired when placement resolution concludes. |
Stdio MCP Protocol Tool Suite
When you connect @tradeimpression/mcp to Cursor Composer or Claude Code, your agent gains access to specialized autonomous tools.
| Tool Name | Role | Parameters | Description |
|---|---|---|---|
| ti_check_placement | Pre-flight Probe | publisher_id, slot, app_context | Validates slot eligibility, diagnoses unfilled auctions, and probes live edge fill before coding. |
| ti_validate_integration | Verification | file_path, publisher_id, slot | Scans code changes to verify mandatory "Sponsored" disclosure, valid slot id, and zero CLS collapse. |
| ti_detect_stack | Environment Scan | workspace_path | Detects Next.js, Vite, Remix, or static HTML in the target workspace. |
| ti_apply_react | File Generator | publisher_id, slot, app_context | Generates ready-to-mount TiPlacement wrapper components. |
| ti_apply_patch | Auto Patcher | target_file, slot, publisher_id | Directly patches layout or page files to mount placement components cleanly. |
| ti_audit_brand | Compliance Audit | creative, theme | Automated contrast ratio (WCAG 2.1 AA) and brand safety validation. |
| ti_get_manifest | Manifest Reader | none | Retrieves live registry of verified publisher properties and allowed slots. |
AI Chat & LLM Streaming Integration
Monetize generative AI agents and interactive chat interfaces without adding latency to the streaming token pipeline.
The Parallel Stream Execution Pattern
Never await an ad request before opening the LLM stream. Fire TradeImpression.getPlacements asynchronously alongside your streaming inference call. When token generation finishes, the placement promise is already fulfilled and ready to mount beneath the final assistant response.
import { TradeImpression, trackPlacement } from '@tradeimpression/sdk';
const ti = new TradeImpression({ relevancy: 0.2 });
// 1. Fire ad resolution in parallel with LLM invocation
const adPromise = ti.getPlacements(
'pub_rescriptum',
messages,
[{ slot: 'below_response', placement_id: 'chat_main' }],
{ sessionId: chatSession.id }
);
// 2. Stream tokens immediately to client without blocking
for await (const chunk of streamLLM(messages)) {
controller.enqueue(chunk);
}
// 3. Await ad promise (already completed during token stream)
const { placements } = await adPromise;
if (placements[0]) {
await trackPlacement(placements[0]);
// Yield placement object to client UI
}Edge & REST API Reference
Low-latency global endpoints deployed on Cloudflare Workers edge nodes.
https://tradeimpression.com/v1/placementResolves the highest-clearing contextual campaign for an approved publisher slot.
publisher_id (string, required): Registered property ID (e.g. pub_termscore)slot (string, required): Placement slot name (sidebar, post_result, below_response, inline_tool, agent_turn)app_context (string, optional): Context keywords (e.g. legal_saas)theme (string, optional): light or dark (default: light){
"fill": true,
"placement_id": "plc_9f82d1a4",
"creative": {
"headline": "Serverless Postgres with Zero Cold Starts",
"body": "Branch your production database in under 500ms. Built for Next.js and Cloudflare Workers.",
"cta_text": "Deploy Free Database",
"cta_url": "https://tradeimpression.com/v1/event/click?c=cmp_neon&p=plc_9f82d1a4",
"sponsor_name": "Neon",
"sponsor_domain": "neon.tech",
"badge_text": "Sponsored"
},
"tracking": {
"impression_beacon": "https://tradeimpression.com/v1/event/impression?p=plc_9f82d1a4&c=cmp_neon",
"viewability_required_dwell_ms": 1000,
"viewability_threshold_percent": 0.5
}
}https://tradeimpression.com/v1/event/impressionExecutes after client verifies 1.0 continuous second of 50% placement visibility. Cryptographically records billable impression in the publisher barter clearinghouse.
https://api.tradeimpression.com/v1/event/conversionAttributes downstream developer conversions (signups, CLI installs, account upgrades) to verified impressions.
https://api.tradeimpression.com/v1/creative/validateAutomated contrast ratio validation verifying minimum 4.5:1 body text contrast and 3:1 button contrast before clearing creatives.
Slot Specifications & Zero-CLS Guarantee
Every Trade Impression component enforces strict UX standards. Unfilled auctions instantly collapse with zero cumulative layout shift.
Designed for persistent application sidebars, navigation drawers, and secondary panels. Max width 320px.
Appears inline directly beneath successful API tests, code executions, or audit reports.
Positioned beneath streaming AI completions and agent answers. Unobtrusive horizontal card.
Integrated directly into playground panes, query consoles, and terminal shells.
Embedded cleanly between sequential autonomous agent actions and subagent tool dispatches.
High-visibility contextual placements in developer portal headers and footer zones.
Barter Clearinghouse & Credit Ledger
Convert impressions into cross-promotional developer attention or hybrid cash payouts without middleman ad exchange taxes.
80 of every 100 hosted impressions mint Attention Credits for the publisher.
20% reserve pool provides immediate demand liquidity for cash advertisers.
1 credit guarantees 1 verified MRC-dwell impression on peer software products.
MRC Viewability, Brand Safety & Privacy
Strict programmatic compliance guarantees for publishers and sponsors.
MRC 1.0-Second Dwell Verification
Zero phantom impressions. Beacons execute only after 50% of pixel surface area dwells in the active browser viewport for at least 1.0 continuous second. Background tabs pause immediately.
Zero Cookie Dependencies (GDPR/ePrivacy)
Trade Impression stores zero cookies in user browsers, collects no PII, and operates entirely on contextual signals passed by the host application. No cookie consent banners required.
Mandatory "Sponsored" Disclosure
Every creative includes clear disclosure identifying the sponsor domain. Preserves host developer trust and complies with FTC and European consumer protection directives.
Publisher Competitor Blacklists
Publishers maintain full sovereignty over which sponsors appear on their properties. Block direct competitors or untrusted domains directly in the Publisher Console.