Placement attributes
Every placement is a<div> with two data attributes:
| Attribute | Purpose | Values |
|---|---|---|
data-thrad-type | When the ad triggers | opener, contextual |
data-thrad-format | How the ad looks | message, prompt, carousel, poll |
Case A — Opener ad
Place a<div> directly below your chat input component. The SDK renders the opener ad automatically on page load — no JavaScript call needed.
- HTML
- React / Next.js
Case B — Opener + contextual together
Combine both placements on the same page. The opener fires on load; the contextual fires when you callthrad.render().
Case C — Multiple contextual placements
Give each placement a uniqueid and pass target to specify which one to render into.
Case D — SPA / cross-page pairing
In a Next.js or SPA layout where the opener is on one page and the AI response is on another, pass a sharedturnId to correlate them on the backend.
Optional: identity & theming
Setwindow.thrad_config before the SDK script tag to pass user identity and theme options. All fields are optional.
