Integrate

Placement after the answer

The slot sits under the model’s finished answer, once. It does not sit inside the answer, and an empty response leaves no gap.

Last updated · 8 min read

On this page

The slot sits under the model’s finished answer. It does not sit inside the answer, and it does not sit between tokens while the answer is still streaming. There is one slot for that answer. If Visor returns nothing, the app renders nothing. There is no blank box and no reserved gap.

That is the whole placement rule. The rest of this page is how to keep it in a real chat UI: streams, refusals, the label, the layout, the keyboard, and a screen reader. Visor picks a card or a strip. You do not design the unit, and you do not rewrite the answer to make room for it.

The order of a turn

A turn has an order. Someone asks. The app’s model writes the answer. Only then can the app ask Visor for one ad. Visor is not in the generation step. It does not see the tokens as they are produced, and it does not change the words.

Someone asks. The model writes the answer to completion. You decide that answer is one a person can use. Then the app asks for one ad. How it works follows the same path through to reporting.

Wait for the stream to finish

Most chat apps stream the answer. Tokens arrive over time, and the bubble grows. The slot waits until that stream has finished. Do not insert it between tokens. Do not split the answer in half and put the ad in the middle. Do not pin the ad to the bottom of the screen while the model is still writing.

Do not mount on the first token

The first token is not an answer. A loading state is not an answer. Mount the slot from the signal your app already uses to mark the reply as finished: the stream closed, or your own done flag flipped. If that signal can fire twice, the second fire must not add a second slot.

The answer can still change

Some apps replace a streamed draft with a final message, or append a correction after a tool call. Wait for the text you will actually leave on screen. If you already rendered an ad and then replace the answer with a refusal or an error, remove the ad. Do not leave it attached to words that are gone.

One slot per answer

There is one ad per answer, and it is always labeled. A long answer made of several paragraphs is still one answer. Put the slot after the last paragraph, not after each of them. Do not add a second slot because the answer was long, or because the first request returned nothing and you wanted another try in a loop.

A later question is a new turn and can have its own slot. Do not refresh an ad in a loop to create another view. The terms of service forbid that, and they forbid hiding or stacking ads. We do not publish a frequency cap beyond one ad per answer. Frequency and UX does not add a second unit.

When there is no answer to follow

We recommend you skip the slot when the model refuses, when the app shows an error, or when the answer is empty. A person who got no answer should not get an ad in its place.

This is a recommendation about when to ask, not a published error code. Your app already knows these cases. If a turn becomes a refusal after you asked, take the slot back out.

  • Refusal. The model declined. Skip the slot.
  • Error. The request to the model failed, timed out, or showed an error state. Skip the slot.
  • Empty. The final text is blank. Skip the slot.
  • Still streaming. Wait. Do not mount yet.

No blank reserved space

No-fill is a normal result. Nothing qualified, so nothing renders. The thread should look as if you never asked. A reserved gap reads as a broken layout. A blank card reads as a missing ad.

Do not give the slot a minimum height while you wait. Do not show a skeleton shaped like a card. Do not use a faded box as a placeholder. An empty container with no height, no padding, and no minimum height takes no space. visibility: hidden keeps the gap. Do not use it on the slot. If you are unsure the empty node is truly collapsed, remove the node.

The label

The label is always Ad · Sponsored. The middle dot is part of the wording. Both words are part of the wording. It is plain text, at the top-left of the ad. The wording does not change, and it is not restyled away.

Do not shorten it, drop the dot, replace the words with an icon, or hide them on a small screen. The ad content policy says every ad is labeled, and that the ad must not imitate the assistant.

Ad · Sponsored
An unbranded silver laptop and a white mouse on a pale desk

14-inch student laptop

$899

Light enough for campus, with 16 GB of memory and a battery that lasts a day of classes.

The picture is a made-up product, not a live ad. Visor picks the card or the strip. See Ad format.

Keep it separate from the assistant

The answer belongs to the person who asked. The ad comes after it, once, with its name on it. A reader should be able to tell the two apart without studying the screen. The container, the voice, and the speaker are different.

  • Do not put the ad inside the assistant’s bubble.
  • Do not give the ad the assistant’s avatar or the assistant’s name.
  • Do not write the ad in the model’s voice, and do not prefix it with the assistant’s name.
  • Do not let the slot’s node sit inside the answer’s node. If the snippet moves or rewrites the answer, that is a placement bug.
  • Keep the label at the top-left, in plain text, even if your thread is otherwise quiet.

Visor does not rewrite the model’s words. Do not wrap the ad so it reads as part of the same message. A clear gap is enough. We do not publish a required pixel distance.

Layout in a chat thread

Put the slot in the thread column, after the answer component, as the last thing in that turn. Do not float it in a side rail beside the answer. Do not make it a modal. Do not make it a sticky bar. Do not make it a banner across the top of the screen. Those are not the format. The slot is not a pop-up and not an interstitial.

Full width under the answer

The ad is the full width of the thread column, directly under the answer bubble, not inside the bubble’s padding. The answer can stay in your usual bubble. The ad is the next block. The person should be able to scroll past it. Do not cover the answer to keep the ad in view.

Narrow screens

On a phone, the order stays the same. The answer is first. The ad is under it, full width of the thread. It does not become a pop-up, a sticky footer, or a banner. Check a width around 390px. That check is on the testing checklist. In a dark thread the words Ad · Sponsored stay readable. We do not publish a hex color for your theme.

Keyboard and screen readers

The ad is part of the page, in reading order, after the answer. The link or button inside it is in the tab order after the answer’s controls. Do not move focus to the ad when it arrives. Do not trap focus inside the slot. Do not autofocus the ad. If there is no ad, do not leave a tab stop on an empty slot.

Name the region for assistive technology. Use an aside with aria-label="Advertisement". The visible label still has to be in that region. The accessible name does not replace the words Ad · Sponsored. Do not set aria-hidden on the ad. Do not announce the ad as part of the assistant message. The aside boundary is what keeps those separate.

HTML: advertisement landmarkhtml
<aside aria-label="Advertisement">
  <!-- One labeled ad, or remove this region when there is no fill. -->
</aside>

If the snippet you are issued already renders this landmark, do not wrap it in a second one. The notes that arrive with the snippet say which case you are in. Those notes are not on this page. A screen reader should hear an advertisement, then the visible label, then be able to move on. It should not hear the ad as the assistant.

Hook the slot to the end of the stream

The samples below are illustrative. @visor/react and AdSlot are not a published install command. YOUR_PUBLISHER_ID is a placeholder. streaming, answer.refused, and answer.error belong to your app. They are not Visor fields. The JavaScript function name is yours. The snippet issued after the traffic check is what actually requests the ad.

Illustrative: after the stream endstsx
import { AdSlot } from "@visor/react";

// Illustrative. Call this only after the stream finishes.
// streaming is your flag. It is not a Visor field.
export function Turn({ messages, answer, streaming }) {
  const showSlot = !streaming && answer && !answer.empty && !answer.refused && !answer.error;

  return (
    <>
      <AssistantMessage text={answer} />
      {showSlot ? (
        <AdSlot
          publisherId="YOUR_PUBLISHER_ID"
          messages={messages}
          locale="en-US"
          country="US"
        />
      ) : null}
    </>
  );
}

Do and do not

Do and do not
DoDo not
Wait until the stream has finishedRequest on the first token, or between tokens
Place one slot under the final answerPlace a slot inside the answer or between paragraphs
Skip refusals, errors, and empty answersShow an ad where the answer failed
Render nothing when there is no fillKeep a blank box, a skeleton, or a reserved gap
Keep Ad · Sponsored at the top-left, in plain textRestyle the label, hide it, or replace it with an icon
Keep the ad visually separate from the assistantGive the ad the assistant’s avatar, name, or bubble
Leave one slot on that answerStack a second ad, or refresh the slot in a loop
Put the ad in tab order after the answerMove focus to the ad, or leave a tab stop on an empty slot
Name the region AdvertisementHide the ad from assistive technology

Formats you do not design

A card has a picture or banner, a name, one or two sentences, and a link or button. A strip is one line: the label, a short sentence or name, and a link. Visor chooses which of the two comes back. The publisher does not pick the creative, and the publisher does not design a third layout.

Your job is the slot: after the answer, one, labeled, gone when empty. Build it on the web, in React, on a server, or in a mobile app. Testing is the checklist before it goes live.

Was something unclear? Contact support