Presence Visitor Side
The Glance Presence scripts provide functionality for:
- Tracking the presence of visitors on a website, including visitor identity, browser and platform information, as well as custom data.
- Signalling website visitors to take actions such as starting a Cobrowse session.
Glance Presence includes both:
- Visitor side functionality to send visitor data to the Presence service and listen for agent commands.
- Agent side functionality for looking up visitor information and signaling visitors.
Adding Visitor Presence to Your Website
There are two ways to include Visitor Presence functionality in your website. You can get default Presence behavior by adding some parameters to your Cobrowse script tag, or you can load and use the Presence API for more control.
<script id="glance-cobrowse" data-visitorid="49Q750P2" ... >
Default Presence Behavior
Add a data-presence='on' attribute to the Cobrowse script tag.
Specify a visitor id, either as a property on the JavasScript variable window.GLANCE_COBROWSE (see Cobrowse Visitor API) or as an attribute in the cobrowse script or meta tag data-visitorid (see Add Cobrowse to Your Website ).
With this approach:
Default Presence information is sent to the Presence service when the page first loads and again if it regains focus.
The visitor listens for functions invoked via
NOTE: The GLANCE.Presence.Visitor API will be available on the page, but you will not need to use it to get the default behavior described here.
Specifying or Changing Visitor ID After Page Load
In some cases, the visitor ID may not be known at the time the page is served by the webserver, or the visitor identity may change after the initial page load. To support these scenarios, call
GLANCE.Presence.Visitor.setVisitorId(visitorid) once the visitor ID is known.
setVisitorId, the initial value of visitor id on page load can not be null. If the value of the visitor id on page load is not known, use a placeholder value and then change it with
setVisitorID at a later date.
Custom Presence Data
Custom data can be included in the Presence data that is stored on the Glance Presence server. Examples of custom data might include a page name, user's shopping cart value, or the user's most recent transaction.
Custom data can be added to the Cobrowse script tag as attributes prefixed with "
data-user-", for example:
<script id="glance-cobrowse" data-presence="on" data-user-lasttrans="transfer" ...>
NOTE: The data-presence attribute should NOT be included in the script tag in iframes, nor does the visitor id need to be specified.