Contents
Configuration API
This API configures Co-browse and its integration with other media. It is also used to subscribe to the main Co-browse JavaScript API.
Co-browse is configured via a global _genesys variable. To configure Co-browse, create a <script> such as the following example and add it to your instrumentation:
<script>
var _genesys = {
cobrowse: {
/* Co-browse configuration options */
}
};
</script>
<INSTRUMENTATION_SNIPPET>
Accessing the Co-browse APIs
Since the main Co-browse JavaScript file is added to the page asynchronously, you cannot instantly access the Co-browse APIs. Instead, you must create a function that will accept the APIs as an argument. There are two approaches to creating this function.
You can assign the function to the special property of a global configuration variable:
<script>
var _genesys = {
onReady: function(APIs) {
APIs.cobrowse // Co-browse API
}
};
</script>
<INSTRUMENTATION_SNIPPET>
// or
<script>
var _genesys = {
cobrowse: {
onReady: function(cobrowseApi) { ... }
}
};
</script>
<INSTRUMENTATION_SNIPPET>
Alternatively, you can modify configuration to make the APIs accessible at any point in your application through a _genesys global variable.
To do this, you must first assign an array to the onReady property:
<script>
var _genesys = {
onReady: []
};
</script>
<INSTRUMENTATION_SNIPPET>
// or
<script>
var _genesys = {
cobrowse: {
onReady: []
}
}
</script>
<INSTRUMENTATION_SNIPPET>
You can then obtain the APIs at any point in your application using the following code snippet:
_genesys.onReady.push(function(APIs) {
APIs.cobrowse // Co-browse API
});
// or
_genesys.cobrowse.onReady.push(function(cobrowseApi) { ... });
Disabling Co-browse
You can disable Co-browse using JS instrumentation. To do that, pass the value false to the respective configuration subsection:
<script>
var _genesys = {
cobrowse: false
};
</script>
Configuring the Co-browse Button
You can hide the Co-browsing button. This might be useful if you want to start co-browsing from your own custom button (or from any other element or event), using the Co-browse API.
<script>
var _genesys = {
buttons: {
cobrowse: false
}
};
</script>
You can change the position of the Co-browsing button:
<script>
var _genesys = {
buttons: {
position: 'right'
}
};
</script>
By default, the position is left and the button is visible.
Providing Custom HTML for Buttons
You can also pass functions that return HTML Element to buttons.cobrowse. In this case the output of the function will be used to render the button instead of using default image.
Here's a simple example that makes use of jQuery library to generate HTML Elements:
function createCustomButton() { return jQuery('<div class="myButtonWrapper"><button class="myButton">Co-browse!</button></div>')[0]; } var _genesys = { buttons: { cobrowse: createCustomButton } };
Localizing the Co-Browsing Button
By default the buttons are images and therefore they cannot be localized in the same way as the rest of the interface. To localize these buttons, you can use one of the two following methods:
- Provide custom localized buttons instead of the default ones, as explained in Providing Custom HTML for Buttons.
- Override the appearance of the buttons using CSS.
For more information about localizing Co-browse, see Localization.
Co-browse Configuration Options
The following options are configurable as properties of an object passed to _genesys.cobrowse:
enableStaticResourceService
Default: true
Set to true to enable the Static Resources Behind Authentication feature, which will cache resources. Setting to false disables the feature.
Example:
<script>
var _genesys = {
cobrowse: {
enableStaticResourceService: true;
}
};
</script>
debug
Default: false
Set to true to enable debugging console logs. You can enable full Co-browse logs, using this example:
<script>
var _genesys = {
debug: true;
};
</script>
Or reduced Co-browse logs, as shown below:
<script>
var _genesys = {
cobrowse: {
debug: true;
}
};
</script>
For debugging purposes, we recommend the first example. However, this example can also turn on logging from other Genesys tools, if you are using any and if you configure them using the _genesys variable.
disableBuiltInUI
Default: false
Set to true to use a custom Co-browse UI. Use the Co-browse API to implement a custom UI.
Example:
var _genesys = {
cobrowse: {
disableBuiltInUI: true
}
};
You can still start the Co-browse session with the configuration above but the main components of the UI such as the toolbar and notifications will be absent.
primaryMedia
Default: null
Used to pass an object implementing an external media adapter interface.
Example:
<script>
var myPrimaryMedia = {
initializeAsync: function(done) { /* initialize your media here and then call done() */ },
isAgentConnected: function() { /* return true or false depending on whether an agent is connected */ },
sendCbSessionToken: function(token) { /* send the Co-browse session token to agent */ }
};
</script>
<script>
var _genesys = {
cobrowse: {
primaryMedia: myPrimaryMedia
}
};
</script>
<INSTRUMENTATION SNIPPET>
See External Media Adapter API for more details.
css
Default: Server synchronization strategy, {server: true}
This option manages the CSS synchronization strategy. Additional CSS synchronization on top of DOM synchronization allows you to replay style changes that occur when the user moves his or her mouse over an element with a :hover style rule.
maxOfflineDuration
Default: 600 (seconds)
This option specifies the time in seconds that a reference to a Co-browse session is stored after page load. The default value is 600 seconds (10 minutes). If this period expires, the Co-browse session will end by time out.
You can set this option, as shown in this example:
<script>
var _genesys = {
cobrowse: {
maxOfflineDuration: 300;
}
};
</script>
Deprecated version:
<script>
var _genesys = {
maxOfflineDuration: 300
};
</script>
disableWebSockets
Default: false
Use this option if you need to disable WebSocket communication such as when your load balancer does not support WebSockets and you do not want to wait for Co-browse to automatically switch to another transport.
You can set this option, as shown in this example:
<script>
var _genesys = {
cobrowse: {
disableWebSockets: true;
}
};
</script>
Deprecated version:
<script>
var _genesys = {
disableWebSockets: true;
};
</script>
localization
Default: null
Use this option to localize Genesys Co-browse. For a detailed description, see Localization.
setDocumentDomain
Default: false
Determines if Co-browse sets the document.domain property. If set to true, Co-browse modifies the document.domain property. If set to false, Co-browse does not modify document.domain.
Available since Co-browse JavaScript version 8.5.002.02. For your Co-browse JavaScript version, see the VERSION property.
Example:
<script>
// Turn on setting document.domain:
var _genesys = {
cobrowse: {
setDocumentDomain: true
}
};
</script>
disableBackForwardCache
Default: true
Available since Co-browse 8.5.1.
By default, Co-browse disables Safari's Back/Forward cache which can stop co-browse sessions from functioning.
Example:
<script>
// Turn BackForward Cache back on:
var _genesys = {
cobrowse: {
disableBackForwardCache: false
}
};
</script>
cookieFootprintReduce
Default: false
Set to true to enable cookie footprint reduce feature which allows to store session between page reload and relocation into site storage instead of cookies.
Example:
<script>
var _genesys = {
cobrowse: {
cookieFootprintReduce: true
}
};
</script>