Cobrowse Visitor User Interface API

Cobrowse Visitor User Interface API

The Cobrowse Visitor User Interface API implements methods for displaying elements of the Cobrowse Visitor user interface, such as the Terms and Conditions dialog and the Cobrowse button. You also have the ability to customize the visitor-side user interface.

While most customers will use the “glance-button” attribute to connect web page elements with Glance Cobrowse functionality, for some implementations it is preferable to use the Visitor User Interface API directly.

GLANCE.Cobrowse.VisitorUI

The GLANCE.Cobrowse.VisitorUI object is defined in the standard Glance Cobrowse JavaScript, as long as a custom User Interface has not been specified. VisitorUI exposes methods for displaying the default user interface. See Getting Started for more information on using the default vs. a custom visitor user interface.

Methods

The following methods are available on GLANCE.Cobrowse.VisitorUI:

Method Description
promptCrossDomain(crossDomainParams) promptCrossDomain() prompts the user to continue a session on a new domain. Using promptCrossDomain()
  1. alerts the user that something is about to happen,
  2. ensures that there is a user click before the domain transition, avoiding popup blockers

promptCrossDomain() displays a confirmation message box like:

Would you like to continue the session on abc.com?
[Yes][No]

On Yes, GLANCE.Cobrowse.Visitor.crossDomain() is called to continue the session.

The colors, fonts, and text on the confirmation message box are customizable via the button customization tool.

promptCrossDomain() returns a promise which resolves when the process is complete. If the session has already been continued on other domains at the time promptCrossDomain() is called, the function returns a resolved promise.
setStyle(groupid) If the page is configured to cobrowse in multiple groups, call setStyle to control which group’s cobrowse button customization should be used. If setStyle() is not called, the button customization is selected based on the group passed to showTerms or startSession
showButton(show)* showButton(show) displays the cobrowse button if show is true. If show is false, it hides the button.
showTerms(termsParams) showTerms(termsParams) shows a terms and conditions dialog. The dialog, which is customizable via the cobrowse button customization tool, has an Accept and a Decline button. Clicking Accept will start a cobrowse session. termsParams is optional, and can contain any of the same properties as startParams.

See startSession in the GLANCE.Cobrowse.Visitor section.
toggleButton()* toggleButton() toggles the display of the cobrowse button.

* Indicates method is only available through the original widget.

Custom UI

If using a custom UI (data-ui="custom" in the script tag) then the customer supplied user interface script can conditionally modify the user interface according to which group a session is running in. The custom user interface script can use the api GLANCE.Cobrowse.Visitor.sessionGroupId(), which returns the groupid for the currently running session, if any.

It is not possible to use a custom UI for one group and the default UI for other groups.