When loading the Laiye Chatbot widget on your website, you can modify its behavior by setting some attributes for the component.
They can be set in the following way:
widget.setAttribute("attribute", "value");
Here is a full example of integrating a widget and setting an attribute:
<script>
var widget = document.createElement("destygo-webchat");
widget.setAttribute('id', "destygo_widget");
widget.setAttribute('class', "destygo_widget");
widget.setAttribute('token', "d8380225-f558-f1d8-d055-f022657c95c4");
widget.setAttribute("attribute", "value");
document.body.appendChild(widget);
</script>
<script type="text/javascript" src="https://widget.mindsay.com/destygo-webchat.js"></script>
Here are the attributes that you can currently modify:
Attribute | Values | Description |
---|---|---|
mobile | true or false (default false ) | Set to true to integrate the widget in a mobile application. |
useLocalStorage | true or false (default false ) | Set to true to keep the message history in the local storage instead of the session storage.In particular, the conversation will persist if the tab is closed, and the conversation will be synchronized between tabs if multiple ones are open. |
disableCsatDisplayedZdTag | true or false (default false ) | Set to true to disable the sending of laiye-csat-displayed tag when the Zendesk CSAT is proposed to the chatters.See Zendesk chat documentation for more information about that tag. |
user_consent | true or false (default None ) | Set to false to exclude user messages from the labelling feature which allows the bot to be trained on user messages.See Labelling chat documentationfor more information about the feature. |
Passing attributes to bot context
Custom attributes added this way are also passed to the Bot context, so that you can enrich your use-cases based on data coming from your website.
Check that tutorial for more information about this.