Initialization
Safely wait for the SDK before calling window.remark.
Widget Control
Programmatically open, close, hide, and show the chat widget.
Event Handling
Listen to user interactions and create custom integrations.
Waiting for Remark to initialize
Because the Remark script loads asynchronously,window.remark may not be available when your code runs. Before calling window.remark, wait for the remark:session-initialized event on window:
window.remark is already available:
Customizing your user experience with the Remark SDK
The Remark SDK can also be used to control the state of the chat widget. You may wish, for example, to temporarily close the chat widget when displaying full-screen promotions or open the chat widget when a customer clicks on a certain call-to-action on your site. You can open, close, hide, and show the chat widget using one of the options in the following code.show. To close the chat panel for a moment, use close instead.
Opening the widget with options
In addition to simply opening the widget, you can pass options to prefill a message or send it right away.Available options
- message – Text for the chat input. On its own, it fills the input and leaves sending to the shopper.
- mode – Set to
'send'to sendmessageright away, starting a conversation (or reopening a closed one) if needed. The default,'pre-fill', only fills the input.
Embedded and floating widget coordination: When both the floating chat (
<remark-chat-widget>) and embedded chat (<remark-qa-activator>) appear on the same page, they coordinate automatically. Only one widget holds the active conversation at a time — the other shows a “paused” state with the matched expert’s avatar and a button to resume the conversation there.On mobile viewports (480 px and below), tapping a prompt in the embedded chat opens the floating widget full-screen instead of starting an inline conversation. The floating widget does not auto-reopen from persisted state across page navigations on mobile — it stays closed unless explicitly opened via remark_open=true or window.remark('open').Setting the widget language
The widget uses English unless your workspace has more languages enabled. To add languages, contactsupport@remark.ai. With more than one language enabled, the widget follows the storefront’s language: Shopify’s active locale, then the page’s <html lang> attribute, then the browser language.
To set the language yourself, pass a language code or tag:
URL Parameters
Remark recognizes several URL parameters for controlling widget behavior without writing code. These are useful for testing and sharing links that demonstrate a specific widget configuration.
Append them as query parameters to any page URL:
remark_force_widget=true as well.
remark_force_widget, remark_preview_inline_elements, and remark_preview_floating_widget are also written to sessionStorage when set via URL, so the override persists across page navigations within the same tab. You can also set them directly in sessionStorage, which helps in browsers or environments that strip query parameters:
sessionStorage in DevTools. remark_reset_chat applies once, on the page load that carries it, and Remark doesn’t save it.
Listening for Remark Events
Remark firesremark:-prefixed DOM events from the floating widget, the embedded chat, and the page itself. Listen on window to receive all of them:
Listen to all Remark Events
To listen to all the events, you can use thewindow.remark.events.listenAll function. It takes a callback, called with every remark event. The payload received by the callback is an object:
- with an
event__typekey, one of the remark events listed below - any other details payload the event has with it
listenAll returns an object with an unsubscribe function. Calling that unsubscribe function will stop the callback from being called again.