Interaction targets
Choose where a placement answers a reader's question: in the placement, in the search overlay, or in the Widget sidebar. Set it per interaction with interactionTargets, and style the overlay.
When a reader clicks a suggested question or types a question in a placement, the answer opens somewhere. interactionTargets sets where, for each kind of interaction: in the placement itself, in the search overlay, or in the Widget sidebar. In auto and hybrid mode, Inline sets this on the placement in your dashboard configuration. When you mount the placement yourself, pass interactionTargets in the mount options.
Supported placements
| Interaction | What the reader does | Integrated chat | Key takeaways | Basic embed | Single question |
|---|---|---|---|---|---|
suggestedQuestion | Clicks a suggested question | Yes | Yes | Yes | Yes |
freeTextInput | Types a question and sends it | Yes | Yes | Yes | No |
seeFullAnswer | Clicks See full answer under a long answer | Yes | No | No | No |
By default, the integrated chat answers in the chat, and the other placements open the Widget sidebar. Each placement page lists what its readers see for each interaction.
Values
interactionTargetsQueryobjectWhere each reader interaction is answered. Each field accepts one of these strings (there is no enum for them):
'overlay': the search overlay.'sidebar': the Widget sidebar.'inline': in the placement. Only the integrated chat answers in place. On key takeaways, basic embed, and single question,'inline'opens the Widget sidebar, the same as'sidebar'.
An omitted field keeps the placement's default target.
In the mount options, the SDK ignores a field the placement does not support, such as seeFullAnswer on key takeaways, and a value that is not one of these strings. It logs a warning to the browser console for each.
You do not need to mount a search placement or the Widget for a hand-off. The SDK adds the search overlay or the Widget sidebar to the page when a target needs it.
Overlay style
To set how the overlay looks when an interaction opens there, pass the same overlay options that search placements use. They apply to 'overlay' hand-offs only. openOverlayOn does not apply: a hand-off opens the overlay when the reader asks.
overlayTypeQuerystring'modal' (centered dialog) or 'drawer' (slides up from the bottom). Also available as OverlayType.Modal / OverlayType.Drawer after the script has loaded.
backdropOpacityQuerynumberOpacity of the backdrop behind the overlay, from 0 (fully transparent) to 1 (fully opaque).
overlayBreakpointsQueryOverlayBreakpointConfig[]Per-viewport overrides for overlayType and backdropOpacity. See overlay breakpoints.
When you set overlay options on a placement, also set overlayType.
Examples
From the command queue, before the script has loaded, pass every value as a string (see enums and the command queue):
<div id="article-summary"></div>
<script>
window.InlineAI = window.InlineAI || {};
window.InlineAI.cmd = window.InlineAI.cmd || [];
window.InlineAI.cmd.push(['init', { publisherId: 'YOUR_PUBLISHER_ID' }]);
window.InlineAI.cmd.push(['mount', 'key-takeaways', 'article-summary', {
interactionTargets: { suggestedQuestion: 'overlay', freeTextInput: 'overlay' },
overlayType: 'drawer',
}]);
</script>After the script has loaded, you can use the enums for the overlay options:
window.InlineAI.mount(window.InlineAI.Placement.IntegratedChat, 'inline-ai-integrated-chat-embed', {
interactionTargets: { seeFullAnswer: 'overlay', suggestedQuestion: 'overlay' },
overlayType: window.InlineAI.OverlayType.Modal,
overlayBreakpoints: [{ maxViewportWidth: 767, overlayType: window.InlineAI.OverlayType.Drawer }],
});