Customize the chat widget
Basic customization
Open the widget by clicking on a button
Or create a link with the address #brevoConversationsExpanded:
You can also use any valid CSS selector as the customWidgetButton to assign chat button behavior to an element of your choice. This also hides the default chat button. First, place the following snippet before the main widget code:
Then add this selector to any element on the page:
Change the widget’s width and height
Specify chatWidth and chatHeight (in pixels) before the widget code:
Change the widget’s z-index
Use the zIndex setting to update the default z-index (set to 9999):
See also the setZIndex method.
Change the chat button colors
Specify the colors before the widget code:
Use a color picker to generate hex color codes.
Change the chat button position based on the screen width
Use the following codes to set the chat button position:
'bl'– at the bottom of the screen, on the left'bc'– at the bottom of the screen, in the middle'br'– at the bottom of the screen, on the right'lt'– on the left side of the screen, at the top'lm'– on the left side of the screen, in the middle'lb'– on the left side of the screen, at the bottom'rt'– on the right side of the screen, at the top'rm'– on the right side of the screen, in the middle'rb'– on the right side of the screen, at the bottom
On mobile devices, the “tab” button is always positioned at the bottom of the screen. The “round” button uses the same position on both desktop and mobile devices.
Embed the widget into a block
Specify the id of the block where you want to embed the chat widget before the widget code:
injectTo also accepts direct links to HTML nodes and array-like node collections (including NodeLists and jQuery collections). See injectTo description.
Place the block anywhere on the page:
Then set an appropriate block size, for example:
Conversations occupies the entire block.
Disable Conversations on mobile devices
Insert this code before the widget code:
Alternatively, uncheck the “Mobile button” option in your widget settings.
Identifying existing users
Passing user details to Conversations
Use the updateIntegrationData method to update the visitor’s details in Conversation’s right pane. Use null to remove properties.
If custom properties set in updateIntegrationData match existing contact attributes, they sync with your Contacts database. Otherwise, they’re available in Conversations only.
Any tech-savvy user can modify the identification data sent to Conversations via the JS API. Treat data sent through the JS API as auxiliary information, not as a definitive user identifier.
Binding conversations to user accounts
Conversations recognizes logged-in users regardless of device or browser, maintaining a single conversation thread per user. If one user logs out and another logs in on the same device, the two conversation threads remain separate.
To bind the widget to user accounts on your site:
-
Generate a unique random string for each user and save it to your database.
-
When the user is logged in, specify their string before the widget code:
❗️
visitorIdmust be unique and secret (not available to other users), since it could be used to access a private conversation. Use a randomly generated string. Do not use publicly known data such as a user’s ID, name, or email.
Translating the widget
Choose the widget language from Conversations’ settings, and use the JavaScript API for more granular control (see the language setting).
If the language you want isn’t supported, or you want to change strings in an existing language, override one of the existing languages with your set of strings.
❗
You cannot add unsupported languages as new properties to the locale object (“fi”, “sv”, “pl”, etc.).
The current locale file:
locale.json
To change the chat input placeholder text:
To change more strings, add them to the locale property of BrevoConversationsSetup (following the structure of the original locale file). If no language code key is specified, phrases are changed in all language versions.
You can change as many strings as you want. Strings with keys starting with _ are protected and cannot be changed.
You can also change the locale dynamically using the setLocale method: