Guide
Prompt weaving
Include offers in assistant output without hiding sponsorship or interrupting the main answer.
Supported modes
none: return offers without prompt text.separate_section: add a clearly marked sponsored section.inline_when_relevant: include one concise suggestion when context fits.offers_only: use only when the publisher explicitly requests sponsored options.
Every mode that includes an offer must include sponsorship disclosure.
Track only referenced offers
Prompt-woven offers are not separate UI cards. Include exact Genesis click URLs in the prompt payload, let the model render the final answer, then track impressions only for offers whose exact click URL or stable reference token appears in the rendered text.
import {
getReferencedOfferTrackingUrls,
weaveOffersIntoPrompt,
} from "@thegenesis/prompt-weaving";
const woven = weaveOffersIntoPrompt(response.offers, {
mode: "separate_section",
disclosureLabel: "Sponsored",
});
messages.push({ role: "system", content: woven.text });
const modelResponse = await llm.chat({ messages });
const urls = getReferencedOfferTrackingUrls(
modelResponse.text,
woven.offers,
);Fire those impression URLs from the user's browser after the assistant text is visible. If a model receives three offers but references one, only that one should count as rendered.