Configuration
Learn how to configure your Tolstoy widget to perform different functions on your site.

Settings

We support the following additional configurations:
  • alwaysShow: In case a user closed the widget and you want to keep showing it to him.
    • alwaysShow: true
  • loadHidden: load the widget without showing it.
    • loadHidden: true
  • stopPreviewLoop: stop the preview window from endlessly looping.
    • stopPreviewLoop: true
  • noCloseOption: no option to close the widget.
    • noCloseOption: true
Add the following code to the page in oder to set the settings:
1
window.tolstoySettings = {
2
alwaysShow: true,
3
loadHidden: true,
4
stopPreviewLoop: true,
5
noCloseOption: true,
6
};
Copied!

start()

Start the widget, open it expanded and plays immediately
1
window.tolstoyWidget.start();
Copied!

show()

Show the widget bubble if it was loaded hidden or closed
1
window.tolstoyWidget.show();
Copied!

hide()

Hide the widget bubble from screen
1
window.tolstoyWidget.hide();
Copied!

recreate(tolstoyWidgetId, settings)

Load a new widget with a different Tolstoy Id, remember to replace the {{TOLSTOY_ID}}
1
window.tolstoyWidget.recreate('{{TOLSTOY_ID}}');
Copied!

on(eventType, callback)

Trigger a callback on a specific event
Params:
  • eventType
    supported events:
    • onWidgetOpen - triggers when the widget is opened
    • onWidgetReady - triggers when the widget is ready
  • callback
    A function to trigger
1
window.tolstoyWidget.on('onWidgetOpen', () => { console.log('Widget Opened') });
Copied!
​
Last modified 3mo ago