Javascript functions
Cobrowser puts an Object in the global scope of the document. This object can be accessed by via the 'Cobrowser' variable.
The Cobrowser object has the following methods and variables that can be used:
Cobrowser.initReady. Can be used to assign a callback function that is called after Cobrowser was initialized. This allows you to make sure the Cobrowser object is ready to use.
Example: Cobrowser.initReady = function(){ console.log(Cobrowser); };
Cobrowser._ajaxRefresh(). Re-initializes Cobrowser to mimic a new pageview for dynamic web-pages.
Cobrowser.start(). Initializes Cobrowser, to be used when _cbSettings.autostart is set to false.
Cobrowser._setField. See https://cobrowser.zendesk.com/entries/27855768-Auto-fill
Cobrowser._addLabel. See https://cobrowser.zendesk.com/entries/27855768-Auto-fill
Cobrowser._removeLabel. See https://cobrowser.zendesk.com/entries/27855768-Auto-fill
Cobrowser._getAvailability(callback(available)). Can be used to fetch overall agent availability (online or not true/false). The result is passed as a variable to the defined callback function. This function can also be used before Cobrowser was started, for example to only run Cobrowser.start() if there is availability.
Example: Cobrowser._getAvailability(function(available){console.log('agents are available?', available);});
_cbSettings object
The _cbSettings object can be used to alter settings applied to the Cobrowser monitor script. The settings must be give before loading the script or before calling _ajaxPageview();
_cbSettings.autostart
By default, Cobrowser is initiated after the script was loaded. This can be used to not start Cobrowser automatically. Cobrowser must be started with Cobrowser.start() in that case.
Possible values: true, false
Default: true
_cbSettings.pollMode
Method to use to poll the CoBrowser.net servers.
Possible values: jsonp, ajax
Default: jsonp
_cbSettings.pageURL
Allows you to send a different URL to Cobrowser than the real url.
Value: Only relative URL's are accepted.
Can be using in combination with Cobrowser._ajaxPageview() to push a new URL on dynamic pages.
_cbSettings.endpoint
Allows to change to url to connect to for using the CoBrowser.net service. _cbSettings.endpoint
Default: client
Example: customer.client will route requests to customer.client.cobrowser.net
_cbSettings.version
Allows to switch the site to a different cobrowser version. This is e.g. used when customer specific changes are required. The version must be in the hosts allowed_versions setting.
Default: generic
_cbSettings.proxy
Path to the proxy to use. Pollmode must be set to ajax.
Default: /proxy/cb_proxy.php
_cbSettings.proxySSL
Path to the proxy to use if in SSL mode. Pollmode must be set to ajax.
Default: if not set, it uses the same value as _cbSettings.proxy
_cbSettings.sessionLifetime
The lifetime for a session in seconds. Lifetime is extended on each new pageview.
OR
The amount of seconds a session should be extended when used in combination with sessionKeepAlive
Default: not set, session definition of the browser is used.
_cbSettings.sessionKeepAlive
If sessionLifetime is set, the session life can be extended while a chat or pageview is active. When using this, the session is extended with the sessionLifeTime value each time. This way you can prevent the session from expiring while you are still chatting.
| Value | Description |
| -none- (default) | Do not keep it alive longer than the sessionLifeTime |
| pageview | Extend the lifeTime during a pageview (each comet cycle) |
| chat | Extend the lifeTime during a chat (each comet cycle during a chat) |
_cbSettings.monitorLifetime
Put this on 'session' to make the tracking cookie expire after a session (do not track behaviour of multiple visits).
| Value | Description |
| session | Tracking cookie expires after each (browser) session. |
| always (default) | Tracking cookie expires after one year |
Comments
0 comments
Please sign in to leave a comment.