Self-Hosted Scripts

Glance recommends referencing the Cobrowse script from the Glance CDN at glancecdn.net. When you use the Glance CDN:

  • Glance can easily provide you with updates and enhancements to the Cobrowse product.

  • Changes made using the button customization tool will be automatically applied without involving your website development team.

You can, however, host the scripts on your own server if you prefer. Glance will provide upgraded scripts approximately once per quarter, and will support the current version and at least one version prior.

NOTE: Excel Cobrowsing is not supported for customers who self-host the Cobrowse script.

Glance provides a tool to help generate a single customized self-hosting package, which includes:

  • The standard JavaScript, HTML, and CSS that is currently included in the self-hosting package.
  • Your group’s staging and production custom skin CSS file with your color and branding customizations.
  • Your group’s staging and production custom visitor text JSON files with customized widget text.

NOTE: Glance must turn on self-hosting in order for this package to be available in Manage Your Account.

To host the script on your company website instead of accessing it from our CDN, you will need to:

  1. Download the package by going to Manage Your Account> Settings tab > Cobrowse Settings section> Manage your cobrowse settings. Two links are available for staging and production.

  2. Unzip the package onto your web server.

NOTE: When the Cobrowse script is self-hosted, the script tag src attribute should reference the GlanceCobrowseLoader script as it is hosted on your company website.

<script id="glance-cobrowse"
src="https://www.yourcompany.com/glance/js/GlanceCobrowseLoader_X.X.XM.js"
data-groupid="1"
data-site="staging"
charset="UTF-8">
</script>

NOTE: None of the other scripts, images, or style sheets in the package should be referenced in your website.

Upgrade a Self-hosted Script

Periodically, Glance releases updates to the Cobrowse JavaScript package. To upgrade your website to use the latest scripts, you will need to download a new package and put it on your website. The GlanceCobrowseLoader script in the new package is named with the new version number. You have a couple of options for dealing with upgrades:

To generate and download the self-hosting package:

  1. Once a new release is available, update your website to point to the new version. In other words, in the script tag above, change the version number to match the version number you are upgrading to.

  2. Use a configuration setting on your website to control the version number, for example: src=”https://www.yourcompany.com/glance/GlanceCobrowseLoader_<%=GlanceCobrowseVersion%>M.js“

  3. Copy the GlanceCobrowseLoader_x.y.zM.js script to a generic name “GlanceCobrowseLoader.js” and reference that name in the script src attribute. You will need to make sure that your server applies appropriate cache headers so that visitors will be getting the latest version after you upgrade.

Internet Explorer

Only cobrowse versions 4.15 and earlier support IE11 visitors, so you will need to detect the browser of the visitor and serve them the appropriate cobrowse script version. Below is one possible way to implement this logic. In the example, visitors on IE11 are served cobrowse version 4.15 in staging and 4.9 in production. Visitors on other browsers receive version 4.17 in staging and 4.10.1 in production.

If you choose to follow this example, you will need to modify it as appropriate for your environment (e.g., replace the group ID as well as the src URLs, include or omit the Presence attributes, define the environment as staging or production, etc.).

Additional details about our Internet Explorer 11 policy are here.

function addCobrowseScript() {
  var scriptSrc = "";
  var isProduction = true; // Use this to specify "staging" or "production"
  var isVisitorIE11 = window.navigator.userAgent.indexOf("Trident/") > 0; // Detect whether the visitor is on IE11

  if (isProduction && isVisitorIE11) {
    // The version of cobrowse that an IE11 visitor will receive in production.
    scriptSrc = "https://www.yourcompany.com/cobrowse_4.9.0/js/GlanceCobrowseLoader_4.9.0M.js";
  } else if (!isProduction && isVisitorIE11) {
    // The version of cobrowse that an IE11 visitor will receive in staging.
    scriptSrc = "https://www.yourcompany.com/cobrowse_4.15.0/js/GlanceCobrowseLoader_4.15.0M.js";
  } else if (isProduction && !isVisitorIE11) {
    // The version of cobrowse that a non-IE11 visitor will receive in production.
    scriptSrc = "https://www.yourcompany.com/cobrowse_4.10.1/js/GlanceCobrowseLoader_4.10.1M.js";
  } else if (!isProduction && !isVisitorIE11) {
    // The version of cobrowse that a non-IE11 visitor will receive in staging.
    scriptSrc = "https://www.yourcompany.com/cobrowse_4.17.0/js/GlanceCobrowseLoader_4.17.0M.js";
  }

  //  Create the script tag and add the rest of the attributes.
  var theCobrowseScript = document.createElement("script");
  theCobrowseScript.setAttribute("id", "glance-cobrowse");
  theCobrowseScript.setAttribute("type", "text/javascript");
  theCobrowseScript.setAttribute("data-groupid", 12345); // Use your company's group ID
  theCobrowseScript.setAttribute("data-site", "production"); // Use "staging" or "production" as appropriate.
  theCobrowseScript.setAttribute("charset", "UTF-8");
  theCobrowseScript.setAttribute("data-visitorid", "visitorId"); // If using Presence, define the visitor id.  Otherwise, omit.
  theCobrowseScript.setAttribute("data-presence", "on"); // Omit if not using Presence.
  theCobrowseScript.setAttribute("src", scriptSrc);
  document.head.appendChild(theCobrowseScript);
}

window.addEventListener("load", addCobrowseScript);

By continuing to use the site, you agree to the use of cookies. Learn More