Jump to: navigation, search

Website Instrumentation

You must instrument your website to enable Genesys Co-browse. This means that every page accessible by your customers must include the Co-browse JavaScript code. This code must be on the following page types:

  1. Pages referred through links on the website or reachable through the address bar.
  2. Pages loaded in iframes, which are hosted inside the first type of page.

The Co-browse Javascript code can be added to the web pages of any website that uses mainstream web technologies such as PHP, Java, or .NET.


The Co-browse JavaScript explicitly sets the document.domain property on the master to allow sychronization of iframes loaded from another sub-domain. The document.domain property is always set by Co-browse to the second-level domain.

If the scripts on your website also explicitly set document.domain and the value is different than the value set by Co-browse, one of the attempts (either from your website or Co-browse) to set document.domain will be overridden. This could potentially be unsafe if your site allows third-party users to create their own sub-domains, because it might enable those users to get scripting access to the site.

Co-browse Proxy

You can quickly get up and running with any website by using the proxy-based approach. This approach is an easy way to test Co-browse in a lab environment without modifying your existing site; however, it has significantly lower performance in terms of page loading on the "Master" side. For details about setting up the proxy, see Test with the Co-browse Proxy.

Document Type

Genesys Co-browse relies on modern browser features, if available, and does not work with older browsers such as Internet Explorer 8. To activate these features in browsers which support them, use the appropriate document type definition at the beginning of each page in your website.

For HTML5:

<!DOCTYPE html>

For Internet Explorer, a special meta tag can be added:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

For more information, see the following:

Basic Instrumentation

Co-browse is shipped with two JavaScript applications that each enables different functionality on your website.

  • gcb.min.js — The default Co-browse JavaScript application, which includes Chat and Co-browse functionality.
  • genesys.min.js — The Integrated JavaScript Application, which includes Chat, Co-browse, and Web Engagement functionality.

The rest of this section covers how to add the default Co-browse JavaScript application to your site using gcb.min.js. For information about how to add the Integrated JavaScript Application to your site, see the integrated instrumentation snippet.

To enable Co-browse and Chat, you must add the default Co-browse instrumentation snippet before the closing </head> tag on your web pages:

<script>(function(d, s, id, o) {
  var fs = d.getElementsByTagName(s)[0], e;
  if (d.getElementById(id)) return;
  e = d.createElement(s); e.id = id; e.src = o.src;
  e.setAttribute('data-gcb-url', o.cbUrl);
  fs.parentNode.insertBefore(e, fs);
})(document, 'script', 'genesys-js', {
  src: "<COBROWSE_SERVER_URL>/gcb.min.js",
  cbUrl: "<COBROWSE_SERVER_URL>/cobrowse"

You can use the snippet above to enable Co-browse and Chat on your website, but make sure you update <COBROWSE_SERVER_URL>:

  • To load the JavaScript from the Co-browse server, set the src parameter to the following:
  • To connect the JavaScript application to the Co-browse server, set the cbUrl parameter to the following:

This is the URL of the Co-browse application. It may also be the URL of the load balancer or reverse proxy. To enable secure content synchronization between the Master (end user) browser and the Co-browse Server, use an HTTPS-based URL and HTTPS port instead.

JavaScript does not contain private personal information and can be loaded using HTTP. There are pitfalls in both cases that must be taken into account.

If a website is HTTPS-based, the browser might block JavaScript loaded/executed using HTTP.

Here's an example with values set for the src and cbUrl parameters:

<script>(function(d, s, id, o) {
  var fs = d.getElementsByTagName(s)[0]]]><![CDATA[, e;
  if (d.getElementById(id)) return;
  e = d.createElement(s); e.id = id; e.src = o.src;
  e.setAttribute('data-gcb-url', o.cbUrl);
  fs.parentNode.insertBefore(e, fs);
})(document, 'script', 'genesys-js', {
  src: "",
  cbUrl: ""

The basic instrumentation snippet in the examples above is also part of the default instrumentation for the proxies (GWM and ZAP) that are included in the Co-browse Server installation package. Note that in the proxies <COBROWSE_SERVER_URL> is set to localhost:8700.

For more information about how to test the Co-browse solution using the proxy, refer to the Test with the Co-browse Proxy.

Enabling Console Logs

All logging for the Co-browse JavaScript apps is turned off by default, but it can be enabled on both the master and slave.

Enabling Console Logs on the Master

See Integrated JavaScript Application#debug.

Enabling console logs on the slave

Add the debug=1 parameter to the URL. For example:

Advanced Instrumentation

To customize instrumentation and configuration of Co-browse, see the Co-browse JavaScript API.

This page was last edited on November 27, 2014, at 19:12.
blog comments powered by Disqus