JavaScript API - LiveView / Session Recordings
Configuration
Learn how to configure the LiveView plugin. Go to Configuration
Basic
Manually trigger CoBrowsing events. For example start or stop the session manually.
Script loaded callback
When the JavaScript library is loaded asynchronously or deferred, it is necessary to check then script is initialized. Therefore it exists a global property CVLoaded
. The global property CVLoaded is undefined
when the script is not loaded and executed already. If it is undefined, a callback function can be set to the global propety. It will be called from the script when it is loaded.
function initFunction() {
// your code
}
if (!window.CVLoaded) {
window.CVLoaded = initFunction;
} else {
initFunction();
}
Start Sharing
Start the cobrowsing/liveview session.
CV.liveview.startSharing();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Optin | Support Agent / Visitor |
Live Assistance Button | (optional) |
Stop Sharing
Stop the cobrowsing/liveview session.
CV.liveview.stopSharing();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Optin | Support Agent / Visitor |
Live Assistance Button | (optional) |
Optin
- Sets a flag in the LocalStorage of the browser that the user has opted in for session recordings (i.e. the user clicked the "accept cookies" button).
- Starts the LiveView session.
CV.liveview.optin();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Optin | Support Agent / Visitor |
Optout
- Stops the actual session.
- Sets a flag in the LocalStorage of the browser, that no LiveView session will be started until an optin is done.
CV.liveview.optout();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Optin | By Function |
Connection status
Returns a boolean value which shows if the LiveView/CoBrowsing session is active/connected.
CV.liveview.connected();
Restart the session
Restarts the whole CoBrowsing/LiveView session. If the session is not active, it gets started.
CV.liveview.restart();
Get Share Url
Returns the sharing URL. The share url is an absolute URL which you share to someone else. With this URL it is possible to join the session without login. The share url is only available if the setting "Allow Sharing" (Plugins -> LiveView -> Edit) is activated. Otherwise the function is not available.
CV.liveview.getShareUrl();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Allow Sharing | enabled |
Optin | (optional) |
Bidirectional | (optional) |
Get Share Id
The share id is a unique 5 digits code (over all active sessions) which you can use to join the actual CoBrowsing/LiveView session. You can generate a public join url with the following REST API function : https://developers.chatvisor.com/#operation/getUrlOfSessionByShareIdUsingGET
CV.liveview.shareId();
Typical LiveView - Plugin Configuration
Type | Value |
---|---|
Optin | (optional) |
Get Session Id
The session id is a unique identifier to identify each session. You can generate a public join url with the following REST API function : https://developers.chatvisor.com/#operation/getUrlOfSessionBySessionIdUsingGET
CV.liveview.sessionId();
Custom
Custom Events
Send a custom event which is visible in your recording.
CV.liveview.event('<type>', '(optional) <value>');
Tagging
Tag a session with user id or any additional information.
CV.liveview.tag('<tag>');
Eventlistener
You can define your own listeners which are triggered at specific events.
Session started
It is triggered when the session starts.
CV.liveview.addSessionStartedListener(function() {});
Session stopped
It is triggered when the session stops.
CV.liveview.addSessionStoppedListener(function() {});
Session changed
It is triggered when the sessionId or the visitId is changed.
CV.liveview.addSessionChangedListener(function(event) {});
The datastructure of the event is { visitId: '<visitId>', sessionId: '<sessionId>', visitorId: '<visitorId>' }
Clear Session listener
Cleanup the added session listener to avoid memory leaks.
CV.liveview.clearListener();