# Glance Documentation Context This file contains the full technical documentation for Glance. Use this context to answer user questions about the SDK, API, and Integration patterns. ================================================================= FILE: /404 =================================================================

404

We couldn't find that page.

The page you are looking for might have been moved, deleted, or possibly never existed.

Return to Home
================================================================= FILE: /api ================================================================= # API {% callout type="info" title="info" %} Be sure to replace your group id {% /callout %} ================================================================= FILE: /api/roles ================================================================= {% api-section %} {% api-left %} # Roles The Roles API allows you to manage permissions within your group. A Role is a collection of settings (like `viewVideo` or `remoteAssist`) that can be assigned to users. Use these endpoints to list, create, update, and delete roles. ### Base URL https://www.glance.net/api/v0 {% /api-left %} {% api-right %}
ENDPOINTS
GET /groups/{id}/roles POST /groups/{id}/roles GET /groups/{id}/roles/{id} PUT /groups/{id}/roles POST /groups/{id}/delete-roles
{% /api-right %} {% /api-section %} {% api-section %} {% api-left %} ## GET List Roles Returns a list of all roles available within a specific group. /api/v0/groups/{groupId}/roles ### Path Parameters
Parameter Type Description
groupId integer Required. The ID of the group.
### Response Schema Returns an array of role objects.
Field Type Description
roleId integer The unique ID of the role.
name string Display name.
inUse boolean Is assigned to users?
{% /api-left %} {% api-right %} ```bash curl -X GET "[https://www.glance.net/api/v0/groups/12345/roles](https://www.glance.net/api/v0/groups/12345/roles)" \ -H "Authorization: Bearer " ``` ```json-response [ { "name": "Administrator", "roleId": 10, "description": "Full access to all settings.", "inUse": true, "userCount": 5 }, { "name": "Standard User", "roleId": 11, "description": "Limited access.", "inUse": true, "userCount": 42 } ] ``` {% /api-right %} {% /api-section %} {% api-section %} {% api-left %} ## POST Create Role Create a new role for a group. /api/v0/groups/{groupId}/roles ### Request Body
Parameter Type Description
name string Required. Name (Max 70 chars).
settings object Permission settings.
### Response Schema Returns the newly created role object.
Field Type Description
roleId integer The ID generated for the new role.
name string The role name.
{% /api-left %} {% api-right %} ```bash curl -X POST "[https://www.glance.net/api/v0/groups/12345/roles](https://www.glance.net/api/v0/groups/12345/roles)" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '[{ "name": "Support", "settings": { "viewVideo": true } }]' ``` ```json-response [ { "roleId": 55, "name": "Support", "inUse": true } ] ``` {% /api-right %} {% /api-section %} {% api-section %} {% api-left %} ## GET Role Details Get detailed information about a specific role. /api/v0/groups/{groupId}/roles/{roleId} ### Path Parameters
Parameter Type Description
roleId integer Required. Role ID.
### Response Schema
Field Type Description
roleId integer The unique ID of the role.
settings object Full list of permissions.
{% /api-left %} {% api-right %} ```bash curl -X GET "[https://www.glance.net/api/v0/groups/12345/roles/55](https://www.glance.net/api/v0/groups/12345/roles/55)" \ -H "Authorization: Bearer " ``` ```json-response { "roleId": 55, "name": "Support", "settings": { "viewVideo": true } } ``` {% /api-right %} {% /api-section %} {% api-section %} {% api-left %} ## PUT Update Role Update an existing role. /api/v0/groups/{groupId}/roles ### Request Body
Parameter Type Description
roleId integer Required. ID to update.
### Response Schema
Field Type Description
status string Returns "ok" if successful.
{% /api-left %} {% api-right %} ```bash curl -X PUT "[https://www.glance.net/api/v0/groups/12345/roles](https://www.glance.net/api/v0/groups/12345/roles)" \ -H "Authorization: Bearer " \ -d '[{ "roleId": 55, "name": "New Name" }]' ``` ```json-response { "status": "ok" } ``` {% /api-right %} {% /api-section %} {% api-section %} {% api-left %} ## POST Delete Roles
Warning

Role must be unused before deletion.

/api/v0/groups/{groupId}/delete-roles ### Request Body Array of Role IDs. ### Response Schema
Field Type Description
status string Returns "ok" if successful.
{% /api-left %} {% api-right %} ```bash curl -X POST "[https://www.glance.net/api/v0/groups/12345/delete-roles](https://www.glance.net/api/v0/groups/12345/delete-roles)" \ -H "Authorization: Bearer " \ -d '[ 55, 56 ]' ``` ```json-response { "status": "ok" } ``` {% /api-right %} {% /api-section %} ================================================================= FILE: /api/v1 ================================================================= {% scalar url="/v1.json" /%} ================================================================= FILE: /developer/glance-cobrowse/add_button ================================================================= After you configure your website with the Cobrowse script tag, there will be no visible UI for starting a Cobrowse session. Most customers do not want the Cobrowse UI to be visible while the visitor is not in session, so by default, it is hidden. Glance recommends that you place a clickable element (like a "Cobrowse" link or button) in the footer of every web page. An agent can then ask the visitor to scroll to the bottom and click that element to start a session.
API Reference
Refer to the Cobrowse Visitor API page for additional properties and methods to customize the session experience.
## Add a Button to your Webpage To trigger the session, you can add the `data-glancebutton="startSession"` attribute to an existing element, or use one of the JavaScript commands below: * [showTerms](#showterms) * [startSession](#startsession)
Presence & Attributes
Adding data-glancebutton="[Glance action]" to your page will prevent the Presence event from firing. If Presence is needed, utilize the JavaScript methods below instead of the data attribute.
--- ### Method 1: showTerms The `showTerms` command opens the Terms and Conditions modal with Accept/Decline buttons. Clicking **Accept** starts the session. This is the recommended method for compliance. Show Terms Modal Use the following code to add the `showTerms` command to your website: ```html Cobrowse with an Agent ``` --- ### Method 2: startSession The `startSession` command starts a session immediately (and displays the Cobrowse UI) without a secondary acceptance modal. Start Session UI Use the following code to add the `startSession` command to your website: ```html Start Cobrowse Session ``` --- ## Style the Button You can customize the look and feel of the default button and modal directly in Account Management. 1. Log in and go to **Account Management > Settings**. 2. Click **Manage your Cobrowse settings** in the bottom right corner. 3. Select **Manage Cobrowse customizations** to open the [Cobrowse customization tool](https://help.glance.cx/glance-cobrowse/glance-cobrowse-customizing/cobrowse-widget-customization/). ## Default vs. Custom UI Glance provides a default Cobrowse UI (the border, the session code bar, and the end session button). This is loaded automatically. If you wish to build a completely custom interface (e.g., your own React/Angular components), you can suppress the default UI: 1. Set `data-ui="custom"` on your script tag to prevent loading the default UI script. 2. Implement the `setUIReady()` call in your code. 3. Listen for session events to update your own UI. Refer to the [Cobrowse Visitor API](/api) page to customize the visitor experience. ## Session Code Every Cobrowse session has a **Session Code**. This is a unique identifier available to both the visitor and agent, allowing them to connect. The code may be randomly generated and exchanged over the phone, or it can be assigned automatically via integration with the customer website. After an unidentified visitor clicks the **Show** button, the session code is displayed: Session Code Toolbar ================================================================= FILE: /developer/glance-cobrowse/attributes ================================================================= The script tag generator allows Glance administrators to modify attributes to create a custom script tag that enables Cobrowse on websites. This user-friendly interface will let users fill out each individual attribute for the script tag and then generate a script that can be copied and pasted into their website. Script Tag Generator The following attributes can be found within the script tag. ## Read-Only Tag Read-only attributes are generated based on previous selections made by the user. The following attributes are generated within the script as read only: * **script id** - The identifier used for this script, defaults to `glance-cobrowse`. * **src** - The source of the cobrowse loader script. * **data-groupid** - Your assigned Group ID number provided by Glance. * **data-site** - The environment (staging or production) that this tag will be deployed to. Select the **Staging** or **Production** tab to identify what needs to be generated for this script. * **data-ws** - The webserver being used (e.g., `www.glance.net`). When implementing the script tag on your website, this can be changed for use in beta or a customer-specific environment.
Note
Your Cobrowse script tag includes your company's unique Group ID. If you have multiple Glance groups, make sure when you are testing that the correct Group ID is in the tag, and that you are joining sessions as a Glance user in that group.
### Script Tag Versions: Staging and Production There are two versions of the script tag: one for your staging website, and one for your production website. Which profile of Cobrowse is used on your site is specified by the site attribute in the script tag. You should use Staging for your own internal staging environment and Production for your live site.
Warning
Cobrowse will not work on a website accessed at localhost with the file://protocol. If you are trying out Cobrowse on a local website, please access it via a host name added to your local hosts file or equivalent.
## Basic ### data-presence **Definition:** Determines if the presence scripts are loaded and when the connection is made to the presence server. Omit this attribute if you are not using presence. **Default:** `on` **Options:** `on`, `api` * **on** will load the presence scripts and automatically connect to the presence server if a visitor id is defined in the `data-visitorid` script tag attribute. * **api** will load the presence scripts, but it is the customer's responsibility to manage the connection and other aspects of the interaction. See [Presence Visitor API.](/glance-cobrowse/presence/presence_visitor_api/) ### data-cookiedomain **Definition:** The domain to use for the Cobrowse session cookie. This setting is typically required only for staging sites hosted on a [public suffix domain](https://publicsuffix.org/) such as `azurewebsites.net` or `herokuapp.com`. Specify the full host name as the cookie domain. For example, if your staging site is `abcco.azurewebsites.com`, specify `data-cookiedomain="abcco.azurewebsites.com"` **Default:** N/A **Options:** Hostname of page to be Cobrowsed ### data-cookietype **Definition:** The type of cookie to use for the Cobrowse session. Possible values include the following: * **normal** (default): A non-secure cookie on your website domain. Use this value if visitors need to be able to navigate to insecure pages during a Cobrowse session. * **secure**: A secure cookie on your website domain. You may use this value if visitors will only need to be able to navigate to secure pages during a Cobrowse session. * **ls**: Local storage on your website domain. You may use this value if you would like to avoid adding a cookie to your domain, and if your visitors only navigate to pages on the same local domain. * **dual**: Both local storage and a cookie are used. Use this value if you have existing code which may delete cookies on your website domain, including the Cobrowse session cookie. **Default:** `normal` **Options:** `normal`, `secure`, `ls`, `dual` ## Advanced ### data-additionalgroupids **Definition:** Specify additional Group IDs in the script tag, for example: `data-additionalgroupids="59923,50920"`. It is possible for you to tag different pages with different sets of group ids, but a primary Group ID (`data-groupid`) must be specified and it is used as a default. **Default:** N/A **Options:** Comma separated list of Group IDs ### data-inputevents **Definition:** Maps input events to Glance Cobrowse actions. The `data-inputevents` format is `{ "[modifier]-[keycode]" : "[Glance action]", ...}`. Example: ```html data-inputevents='{"ctrl-13":"startSession", "shift-13":"showTerms"}' ``` **Default:** N/A **Options:** The key code can be any standard JavaScript key code mapped to Cobrowse actions.
Note
Use single and double quotes exactly as shown in the above example. The outer quotes around the attribute value should be single quotes, and the quotes within the attribute value must be double quotes. Customers should still provide a link or button in addition to the key combinations to allow for starting sessions on mobile devices.
### data-scriptserver **Definition:** If you are hosting the script on your own server, add this attribute to tell Glance where to find the additional script and CSS resources that you host. **Default:** N/A **Options:** `[servername]` ### data-startpaused **Definition:** Allows you to start the session in a paused state. Clicking **Enabled** sets `data-startpaused="1"`. **Default:** N/A **Options:** `1`, `omit` * **1** starts the session in a paused state. * **omit** starts the session in an unpaused state. ### data-ui **Definition:** When implementing a custom UI, include this to prevent loading of the default UI script. **Default:** N/A **Options:** `custom`, `omit` ### data-video **Definition:** Starting video size. **Default:** N/A **Options:** `small`, `large`, `off` ## Additional The following attributes can be added to the script tag outside of the script tag generator. ### data-visitorid **Definition:** The visitor id is used when connecting to the presence service if presence is enabled. If defined prior to the session starting, the visitorid will be used as the session key by default. For more information on the visitor id, see [Cobrowse Visitor API](/webservices/visitor_agent/visitor/#cobrowse-visitor-api). This attribute is optional and may be omitted. If included, it must be present when the script tag is initially loaded. **Options:** Because the visitor id is often used as the session key, it must adhere to the requirements of a valid session key. See session key requirements under [Using StartSession](/webservices/visitor_agent/visitor/#using-startsession). ================================================================= FILE: /developer/glance-cobrowse/cross-domain/advanced ================================================================= This page highlights additional situations that may arise when setting up Cobrowse Cross-Domain. ## Multiple Group IDs Organizations utilizing multiple Glance group IDs may find it simpler to create a single helper page on each domain that supports the dynamic specification of the group ID and data-site attributes based on parameters in the helper page's URL. During the Cross-Domain flow, Glance will automatically append the appropriate group ID and data-site values in the URL of each helper page being opened. For example: ```text https://www.yourwebsite.com/helper.html?GlanceSession=1&groupid=&data-site= ``` Below is the sample JavaScript. Ensure you place this inside a script tag on your helper page: ```javascript function addCobrowseScript() { var allowedGroupIDs = ["12345", "23456", "34567", "45678", "56789"]; var urlParams = new URLSearchParams(window.location.search); var groupId = urlParams.get("groupid"); // Check to make sure the group id in the query string is on the allowed list if (!allowedGroupIDs.includes(groupId)) { // If no group ID found in the query string, or there is one that's not on the allowed list // replace with the desired default group id groupId = "12345"; } // Use production as the default, unless staging is specified var dataSite = urlParams.get("data-site") === "staging" ? "staging" : "production"; var theCobrowseScript = document.createElement("script"); theCobrowseScript.setAttribute("id", "glance-cobrowse"); theCobrowseScript.setAttribute("type", "text/javascript"); theCobrowseScript.setAttribute("data-groupid", groupId); theCobrowseScript.setAttribute("data-site", dataSite); theCobrowseScript.setAttribute("charset", "UTF-8"); theCobrowseScript.setAttribute( "src", `https://www.glancecdn.net/cobrowse/CobrowseJS.ashx?group=${groupId}&site=${dataSite}&script=XDOM` ); document.head.append(theCobrowseScript); } window.addEventListener("load", addCobrowseScript); ```
Note
The group IDs in the above sample must be replaced with the group IDs for the organization.
================================================================= FILE: /developer/glance-cobrowse/cross-domain ================================================================= If you expect your Cobrowse sessions to involve interactions across multiple domains, additional configuration is required. ## Setting up Helper Pages To successfully navigate from one domain to another during a Cobrowse session, the Cobrowse script needs to open a "helper page" on the second domain, write a cookie to that domain, and close the helper. This must be done prior to the transition; the helper page will be visible to the visitor briefly before closing automatically. For the fastest and most reliable domain transitions, Glance recommends putting a lightweight helper page on each domain, using this page as a template: ```html Glance Cobrowse Cross Domain Helper ``` Be sure to replace the "YOUR_GROUP_ID" with your group's number (in both locations) as well as the `data-site` value as appropriate.
Note
* The helper URL cannot be a page that redirects somewhere else. * The helper URL cannot require authentication to access.
Alternatively, you can use any existing page on the website which contains a Cobrowse script tag. --- ## Configuring Domains and Helper Pages on your Account Once you have settled on the helper page you are using for each domain, you need to configure the domains and helper page URLs in Glance. Glance will only allow session information to be passed to and from these trusted domains. Follow these instructions to configure cross-domain Cobrowse: 1. As an administrator, log in at [glance.net/login](https://www.glance.net/login). 2. Click on the **Settings** tab, scroll to the **Cobrowse Settings** section near the bottom, and click **Manage Your Cobrowse Settings**. 3. Scroll down to the **Cross-Domain Cobrowse** section. 4. Add each domain as well as a helper page. For example: Cross-Domain Settings Configuration *Example configuration:* - **Domain:** `www.abc.com` - **Helper Page URL:** `https://www.abc.com/glancehelper`
Note
Both the original domain and the destination domain need to be listed. That is, if a session starts on **abc.com** and continues to **def.com**, both **abc.com** and **def.com** need to be listed here.
### Domains vs. Subdomains If your website includes multiple "sub-domains" for the same domain, generally only the top level domain needs to be included. For example, if you have pages on **a.mycompany.com** and **b.mycompany.com**, you only need to add one entry for **mycompany.com**. An exception would be in the case where `data-cookiedomain` is specified in the Cobrowse script tag in order to specify that the cookie be written on the subdomain. In this case, you would use the subdomain specified in the `data-cookiedomain` attribute. So for example, if your script tag has `data-cookiedomain="a.mycompany.com"`, then you would need to add **a.mycompany.com** to the list of domains for cross-domain Cobrowse. --- ## Moving from One Domain to Another At some point during a Cobrowse session, the session information must be passed to all of the domains other than the one on which the session starts. There are several options for making this happen, depending on how your website visitors navigate from one domain to another. ### Static Anchor Tag Links If your visitors navigate to another domain by clicking on an anchor tag `` link, Glance manages the domain transition automatically. The first time a customer clicks on such a link, a popup helper window appears briefly before the browser redirects to the page specified in the anchor tag. From that point on during the session, the visitor may navigate seamlessly between all domains. If you are navigating between domains with links in anchor tags, then your configuration work is complete. ### JavaScript Domain Transitions If your website uses JavaScript, not static links, to redirect the visitor to a new domain, you will need to call the JavaScript method [GLANCE.Cobrowse.Visitor.crossDomain()](/webservices/visitor_agent/visitor/#using-crossdomain) to pass the session information to the other domains. You can call `GLANCE.Cobrowse.Visitor.crossDomain()` at any time before a domain transition, although it is logical to do this either when the [session starts](#setting-up-cross-domain-cobrowse-at-session-start) or on the [navigation event](#setting-up-cross-domain-cobrowse-on-navigation). See below for examples of each implementation. If you would like to ask the visitor for permission before continuing the session on other domains, call `GLANCE.Cobrowse.VisitorUI.promptCrossDomain()`, which shows a confirmation message with Yes / No buttons. The message displayed can be customized on the Account Cobrowse Settings page. ### Pop-up Blockers Because `crossDomain()` opens a new window, it must be called in response to a user action such as a click or keystroke, in order to avoid triggering a pop-up blocker. `promptCrossDomain()` does not trigger a pop-up blocker because the user clicks "Yes" to start the cross domain process. --- ## Examples ### Setting up Cross-Domain Cobrowse at Session Start Calling `crossDomain()` or `promptCrossDomain()` at session start time is a good option in situations where it's difficult to identify the domain transitions and add the API calls as needed. The below code would be used to call `crossDomain()` at the start of the Cobrowse session. ```javascript jQuery(document).ready(function () { GLANCE.Cobrowse.Visitor.addEventListener("sessionstart", function () { GLANCE.Cobrowse.Visitor.crossDomain(); }); }); ``` The sample above works on most browsers. Visitors using Apple Safari may see a pop-up blocker warning the first time they run a cobrowse session. Use `promptCrossDomain()` instead to avoid pop-up blockers, or if a confirmation prompt is desired. ### Setting up Cross-Domain Cobrowse on Navigation The code below is an example of calling `crossDomain()` at the time of the transition to the other domain. This approach is appropriate in situations where crossing domains happens infrequently and it would therefore be unnecessary to send session information to the other domains every time a session is launched. In this example, the website has a button which redirects to a page on another domain using JavaScript.
Note
`crossDomain()` only needs to be called once during a session, although it's ok to call it multiple times.
```html ``` ```javascript function redirect() { // First check to see if a cobrowse session is active // If not, proceed with the redirect as normal if (!GLANCE.Cobrowse.Visitor.inSession()) { window.location = "https://www.example.com"; return; } // In a cobrowse session, send the session information to // other domains and then open https://www.example.com GLANCE.Cobrowse.Visitor.crossDomain({ url : "https://www.example.com", target : "_self" }); } jQuery(document).ready(function () { jQuery("#redirect-button").click(redirect); }); ``` In the following example, `crossDomain()` is called to send session information to other domains, and then a new window is opened on another domain. ```javascript GLANCE.Cobrowse.Visitor.crossDomain().then(function() { window.open("https://www.example.com", "_blank"); }); ``` ### Troubleshooting * If you experience Cross-Domain Cobrowse issues where the agent does not follow the visitor, verify that the Cobrowse script tag is identical on the main website and all helper pages. * If your organization utilizes multiple Glance groups and you want to deploy one set of code that references all the groups, refer to the Advanced Cross-Domain page. ================================================================= FILE: /developer/glance-cobrowse ================================================================= # Glance Cobrowse Get Glance Cobrowse up and running for your team in no time. This section provides an overview of the steps required for setting up Cobrowse on your company website. ================================================================= FILE: /developer/glance-cobrowse/quickstart ================================================================= For your convenience, Glance generates a customized cobrowse script tag for your account that you can copy and paste into your company website. ## 1. Find your Cobrowse Script Tag To locate your unique script tag: 1. Go to [glance.net](https://www.glance.net/) and click **My Account**. 2. Log in using your **Glance Address** and **Password**. 3. Under **Account Management**, click the **Settings** tab. Script Tag Location 4. In the bottom left corner of the **Settings** tab, click on **Manage your Cobrowse settings**. Scroll down to the **Script Tag Generator** section. --- ## 2. Customize the Script Tag Modify your script tag by updating the attributes directly in the generator. Refer to the [Attributes Guide](/attributes) for a complete breakdown of each option. Script Tag Generator
Recommendation
Glance recommends that you start with the default script tag provided in your account settings, and then customize it as needed.
--- ## 3. Add the Script Tag Once you have customized your tag, it must be added to all pages within the website that should be viewable by an agent. * **Location:** The script tag can be placed in the `<head>` or `<body>` section of your website. * **Scope:** Pages without the script tag cannot be viewed. If a visitor navigates to an untagged page during a session, the agent's screen will darken (paused state) until the visitor returns to a tagged page. Body Tag Example
--- ## 4. Add a Start Button After the script is loaded, you need a way for the customer to start the session. See the [Create a Session Link](/create-link) guide to learn how to add a **Join Session** button to your UI. ## Next Steps Once the visitor side is established, you need to set up the Agent side. * **[Agent Join Page](https://www.glance.net/agentjoin/AgentJoin.aspx):** The simplest way to test. Agents enter the code provided by the visitor. * **[Browser Agent SDK](/sdk/browseragent):** A fully customizable solution that lets you build the "Join" experience directly into your CRM or agent desktop. ================================================================= FILE: /developer/glance-cobrowse/script_tag ================================================================= ### Tag Management Tools If your team utilizes a tag management tool (Tealium, Google Tag Manager, Tag Commander, SuperTag, etc.), you may use this to deploy the Cobrowse tag in the head section of the webpages. However, some tag managers (Google Tag Manager, Ensighten, etc.) may not allow you to add attributes to a javascript tag as in the previous examples. To work around this, you can implement your tag into two separate sections: the meta attributes tag and the JavaScript loader tag. The meta attributes tag will include all the attributes needed (`data-groupid`, `data-site`, `data-scriptserver`) as well as all the optional attributes you might want to use (i.e., `data-ui`, `data-inputelements`, etc.). The JavaScript loader tag will provide the link to your group's Cobrowse script with the appropriate version. The meta tag must come first. If not, you will see a "data-groupid missing" error in the console. An example of a leading meta attribute tag looks like this: ```html ``` The script tag must be included on the page itself, as well as within certain iframes. If using a script tag only, the id must be `glance-cobrowse`. If using a meta tag and a script tag, the meta tag id should be `glance-cobrowse` and the script tag id should be `cobrowsescript`.
Note
Always embed the script tag via https to ensure the integrity of the JavaScript file.
#### Use a Meta Tag for Attributes In some environments, it is not possible to add arbitrary attributes to a script tag. Cobrowse parameters can alternatively be specified in a meta tag as shown in the following example: ```html ``` #### Manage Tags The Glance Cobrowse script works with tag management systems such as Tealium and Ensighten and can be added to the page after the page load if desired. If adding the script tag dynamically, the following is the best cross-browser approach: 1. Create the script element and set all attributes except the src attribute. 2. Add the script tag to the document. 3. Set the script tag src attribute. --- ### iframes Iframes must also include a script tag, unless one of the following conditions apply: * The iframe is dynamically built using JavaScript. * The hostname and protocol of the iframe match the parent. For example, the parent is at `https://www.mycompany.com`, and the iframe is also at `https://www.mycompany.com`. In the above listed cases, Glance is able to automatically include the iframe in the Cobrowse session. If the parent is at `www.mycompany.com` and the iframe is at `photos.mycompany.com`, the iframe *must* have its own script tag. Also the iframe URL protocol, HTTP or HTTPS, must match the parent. If your site contains iFrames of third-party content, you must add the third-party site to the Trusted Sites list.
Warning
Iframes will not be included in a Cobrowse session if they are sandboxed to prevent js.
--- ### Self-Hosting Scripts Glance recommends referencing the Cobrowse script from the Glance CDN at [cdn.glance.net](https://cdn.glance.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.
Warning
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 **Account Management**.
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 the **Cobrowse Settings** section of **Account Management**. Scroll down to the **Self-hosting Package** section. 1. Each version of Cobrowse has its own unique package link. 2. If you don't see a link for the version you are expecting, contact Glance support. 2. For Cobrowse versions 6.3.0+, download the corresponding video package from `https://glancecdn.net/video/packages/GlanceVideo_X.X.X.zip` (Replace the Xs with the same version number as the base package downloaded in Step 1).
Note
The video package is required even if your sessions are not using video.
3. Unzip the contents of the packages and place them on your server. Place the base package from Step 1 in a folder named `Cobrowse` and the video package from Step 2 (if using Cobrowse 6.3.0+) in a sibling folder named `video`. * The URL path to the script must contain the word `cobrowse` exactly once, as the script uses this keyword to calculate relative paths for loading its dependencies. * For example, if you plan to host your files at `https://www.yourcompany.com/glance/` then you would create the following folders: * `https://www.yourcompany.com/glance/cobrowse` * `https://www.yourcompany.com/glance/video` 4. Reference the location of the `GlanceCobrowseLoader_X.X.XM.js` file in the src attribute of your script tag, as shown in the following example: ```javascript ``` If you are hosting the script on your own server, add the attribute `data-scriptserver` which tells Glance where to find the additional script and CSS resources that you host, as shown in the following example: `data-scriptserver='https://myscriptserver.net/scripts'`
Warning
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. ================================================================= FILE: /developer/glance-cobrowse/trouble ================================================================= ## Session Issues **Could not parse domain** If you see "could not parse domain from..." or `ERR_DOMAINPARSE` in the javascript console, then you may be accessing the website with a hostname from which Glance cannot parse a domain. Use a hostname like `something.com` or `http://www.something.com/` or `abc.def.something.edu`, or if you can't change the hostname, then set the cookiedomain as explained in the Cobrowse [Getting Started](/glance-cobrowse) section.
Warning
Local file:// urls and localhost:// won't work. You need to add an entry to your lmhosts file.
**Session ends right after starting it** Often, this is a problem writing the Glance session cookie. For example, it is not possible for Glance to write a Cobrowse session cookie for a website accessed on a public suffix domain such as "`azurewebsites.net`." In this scenario, a session will appear to start, but will immediately end. If you are just testing a staging site, you can add an entry to your lmhosts file and access the site via some other name. If you run your production site on such a domain, you can configure Glance to write the session cookie using a full hostname instead of the domain. See the "`data-cookiedomain`" attribute of the Cobrowse script tag as documented in Cobrowse [Getting Started](./attributes/#data-cookiedomain). **Quote characters** Verify that the quote characters in your script tag are correct. Some editors change plain quotes to curved (or "smart") quotes when copying and pasting. If you have a `data-inputevents` attribute on the script tag, verify that you are using double quotes inside the attribute value, and single quotes as outer quotes around the value. The value of `data-inputevents` must be valid JSON. **Script tag ID** If using a script tag only, the id must be `glance-cobrowse`. If using a meta tag and a script tag, the meta tag id should be `glance-cobrowse` and the script tag id should be `cobrowsescript`. **Plugin** If you have been using the Glance Cobrowse Plugin for demos or testing, make sure it is disabled. The plugin is not compatible with instrumented websites. **Only one script tag at the top-level and in each iframe** Verify that there is a script tag in the top level page. A script tag in an iframe is not sufficient. Verify that you do not have multiple Cobrowse script tags in a single document (except for script tags in different iframes). This can cause `SCRIPT_NOT_LOADED` errors when attempting to start sessions from a chat window. **Content Security Policy** If the website has CSP headers, then they must be configured to allow cross domain ajax and websocket requests to Glance. **Ad Blockers** Ad blockers may interfere with Cobrowse functionality. If you have completed all of the required set up and Cobrowse is still not working, trying disabling any ad blockers that you have installed in your browser. **Load Time Delays** Customers may experience load time delays during the first session run on a newly deployed cserver without a primed cache. Delay times can vary based on session volume, the number of CSS files on a page, and the responsiveness of the customer's website. --- ## Built-in properties overridden **WebSocket, XMLHttpRequest** Some javascript libraries override the standard WebSocket or XMLHttpRequest implementations and can prevent Glance from connecting. Type `window.WebSocket` and `window.XMLHttpRequest` into the javascript console. "Native code" indicates that these objects have not been clobbered. **Third party libraries like prototype** Are you using a library like Prototype or mootools which might be modifying built in functionality such as adding `Array.prototype.toJSON`? As a test, enter the following in the js console: `JSON.stringify([1,2,3])` You should get: `"[1,2,3]"` (with only one set of quotes) **Window.self** A common and perfectly legitimate coding construct is: `var self = this;` This can be problematic if var is mistakenly omitted: `self = this; // may overwrite Window.self` Any code with this error will cause problems starting a Cobrowse session. **Using JSLint to detect inadvertent overrides** Running JSLint on your JavaScript can help detect inadvertent global variable declarations. One convenient way to do this is via the [Notepad++ JSLint plugin](https://sourceforge.net/projects/jslintnpp/). Look for errors such as `Undeclared 'some variable name'`. --- ## Visitor tries to start a session and gets an error "Unable to connect to Glance," how can I fix this? Did it work before? If so, did you just add a new CSS Selector to mask some page elements? Delete it and try again. If the Visitor can now start a session, the problem may be the syntax of that CSS Selector that is not supported by Glance today. For example: `#orderPayment\.cardNumber` This is a valid CSS selector. It includes the " \ " character to escape the "." period, since the period should not be in an ID name. But this masking selector will cause the "unable to connect" error. Each time the Visitor starts a session, the latest list of masking CSS Selectors are downloaded. Programmatically that "Start Cobrowse" process today is written in (old) ASP code, so it can share all of our existing load balancing and color selection logic. But ASP lacks built-in functions to generate JSON. The selectors are sent using JSON and JSON needs to escape CSS's escape character. So double escaping might work: `#orderPayment\\.cardNumber` This is not recommended, as this problem should be fixed in the future. In the meantime, try a different selector without the period, such as one of these (less precise) selectors:
`input[id*=cardNumber]`
`input[id$=cardNumber]` --- ## Trouble Setting up Cross Domain Cobrowse? **Cross Domain Error: Untrusted Origin** If you are setting up cross domain Cobrowse, you must remember to enter the primary domain in the Glance backend in addition to the secondary domain that the visitor may be navigating to. If you don't, you will see an error that says `UNTRUSTED_ORIGIN`. --- ## Console Errors **404 error Getting the CustomSkin CSS file** Custom skin not yet created - this is harmless. **404 errors with CAM turned on** It is normal to get 404 errors on the visitor side when CAM (Cobrowse Asset Management) is turned on. The cobrowse script works by creating a copy of the browser DOM and sending it to the agent. To support CAM, resource URLs in the DOM copy are converted to relative urls. On the agent side, these relative urls combine with a `` tag pointing to the Glance Cobrowse server. The resulting combined urls are used by the agent's browser to access resources via the CServer. The DOM copy created by the cobrowse script is not rendered on the visitor side, and is never added into the main DOM that is visible to the user. However most browsers (in anticipation that the DOM copy may be rendered at some point) prefetch the resources that are referenced in it. The visitor browser prefetches those relative urls, which when combined with the visitor's page url or base tag, result in urls for non-existent pages. **Blocked Script Execution for Sandboxed Iframes** Iframes using the sandbox attribute may prevent Cobrowse from injecting scripts which are necessary for the iframe to be rendered on the agent side. In these situations, you will see a console error similar to the following: ```text Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set. ``` If the iframe in question does not render visible content on the page, then the error can safely be ignored. If you wish to avoid the console error in this situation, mask the iframe. However, if the iframe does provide visible content to the user, then the sandbox permissions will need to be adjusted to include `allow-scripts` in order for the Glance script to run within them. --- ## UI issues **The stop button doesn't work, what should I do?** Check to see if you have the injector enabled. **I am having visitor UI issues, what can I do?** If the button, border, agent cursor, or gestures do not appear correctly, there may be CSS on the website that conflicts with Glance's button UI. Often this can be fixed by adding "Custom CSS" in the button customization tool. You can also build your own Cobrowse UI using Glance's API that is compatible with your website. **How can I move the button to the left?** If you require the button to be on the left, follow these steps: 1. Go to the **Glance Client Admin Portal**. 2. Choose **Settings**. 3. Select **Manage your Cobrowse settings**. 4. Go to **Button Customization**. 5. Click on **Custom CSS**. 6. Copy and paste the following code: ```css #glance_cobrowse_btn { bottom: 0px; left : 12px; right : auto } ``` 7. Publish to production after confirming that it behaves as expected. --- ## Trouble on the Agent Side? **Agent freezes on first view, how can I fix this?** If the agent freezes viewing the first screen, there are several possible causes. In all cases, the first step is to look at the agent side JavaScript console. Some common scenarios include: **The viewer side javascript was not retrieved** The Network tab will show errors attempting to get the viewer side JS such as `CobrowseViewer...M.js`. Look at the http status code to see why the script can't be accessed. **The browser can't open a websocket connection** The console may show errors related to failure to open a websocket connection. There may be a proxy configuration that is blocking websockets. A good diagnostic is to test whether the same browser can connect from outside the corporate network. **There are console errors similar to** `Blocked a frame with origin "https://s1006.glance.net" from accessing a cross-origin frame.` 1. Navigate to `chrome://flags` or `edge://flags`. * `Origin-keyed Agent Clusters` must be set to **Default**. 2. Navigate to `chrome://policy` or `edge://policy`. * Search for `OriginAgentClusterDefaultEnabled` within the Browser Policies. If it is enabled, remove it. 3. On Edge, navigate to `edge://settings/?search=security` to check if the browser has Enhanced Security Mode enabled. * Disable Enhanced Security Mode if it is enabled. **I am seeing mixed content warnings in console, what should I do?** Console shows a message like this: *This content should also be served over HTTPS.* This happens when the Cobrowse viewer is in a secure (https) iframe (e.g. Salesforce integration, moxie...) and the visitor is on an insecure (http) page. The fix is to uncheck "Agent follows visitor protocol" on the backend Cobrowse settings page. Then the agent side stays https always, avoiding the mixed content. The downside is that sometimes CSS/images/fonts cannot be accessed by the agent over https. **A portion of the page is blank on the agent side, how can I fix this?** If iframe contents are not appearing on the agent side, verify that any iframes on different subdomains or protocols have their own script tag. **Hover states** If hover states do not show up on the agent side, contact Glance for custom tuning. **Dropdown boxes look funny or do not show up on the agent side** Native dropdown boxes on the visitor side can't be rendered exactly on the agent side, because the agent may be using a different browser, and JavaScript on the agent side can't control the opening and closing of dropdowns. The agent side tries to copy any CSS that is applied on the visitor side for dropdown boxes to get them to look as similar as possible, but this is imperfect. You may have to add CSS on the agent side to force the dropdowns to look a certain way. Contact Glance for custom tuning. **Fonts/icons are not rendering, what can I do?** If your site hosts fonts that are not accessible cross-origin, those fonts will not render on the agent side. To work around this, Glance can host the fonts. Send us the font files (.svg, .woff) and the corresponding font-family names used in the website CSS. **CSS/Styling is missing on the agent side, how can I fix this?** If the agent can join the session, but the page format, fonts, or colors are not correct, then CSS files may be missing on the agent side. The agent side console will usually show an error in this case. CSS may be missing because: * The visitor side website is behind a firewall which the agent cannot access. The agent needs access to the website for CSS and other resources. * The website will only serve CSS if there is a login cookie. Usually if the agent logs into the visitor website before joining the Cobrowse session, the agent can access CSS and other resources. * The visitor page is http and the CSS is not available on the agent side over https. The fix is to uncheck **Agent follows visitor protocol** on the back end Cobrowse Settings page. * The website does not have a valid cert (e.g. a test site) and the visitor is viewing an https page. The agent browser may not want to retrieve the CSS from a server with an invalid cert. **How can I stop CSS animations replaying multiple times?** If a website includes CSS animations, those animations will replay on the agent side whenever there is a DOM change which involves re-adding the animated elements to the page. This can be annoying. It can be best to turn off certain animations by adding Agent CSS in the backend settings page. **Video is not showing properly for agent or visitor, what can I do?** If the video is not showing up properly for an agent or visitor, it may be caused from the video object not being made relative to the Glance button. Follow these steps to make sure that it stays on top of the button so it will be visible: 1. Go to [Glance.net](https://ww2.glance.net/) 2. Log in with your **Glance address** and **password**. 3. Choose **Settings**. 4. Select **Manage your Cobrowse settings**. 5. Under **Button Customization**, go to the **Custom CSS** section. 6. Add the following Custom CSS in the group: ```css .video { position: relative !important; } #glance_ssnkey_box { position: relative; } ``` **The page scrolls on start session, how can I fix this?** If your start session link is at the bottom of a page, clicking the link to start a session may cause the page to scroll up to the top. To avoid this, follow one of these examples for your start session link: ```html Start Cobrowse Start Cobrowse ``` **Cobrowse fails for IE, what should I do?**
Note
As of Jan 1, 2021 IE 11 will no longer be a supported browser for agents connecting to any type of Glance session, including Cobrowse, Screen Share, Agent Video, etc. A website visitor using IE 11 and attempting to start a cobrowse session on a web property configured to use a version above 4.15 will default to 4.15.
**Cobrowse fails multiple times with zero session time, what should I do?** This is a fairly common problem with new deployments, whereby Cobrowse sessions are launched, the session tab pops up and immediately goes away. When you review the session logs, they are listed, but the duration is 0. This is likely the result of the web site being hosted on a Public suffix domain, that does not allow JavaScript to launch. You will have to relocate your website to a private domain to get Cobrowse to work properly. [https://publicsuffix.org/](https://publicsuffix.org/) --- ## JavaScript Console Errors **Blocked script execution** On the agent side it is normal to see "Blocked script execution" errors. The agent viewer sandboxes all "third party" iFrames because the agent side should never run JavaScript other than the Glance viewer scripts which apply updates that are sent by the visitor side. --- ## Trouble Configuring for Salesforce? You can find information on configuring for Salesforce in the [Glance for Salesforce](https://help.glance.cx/integrations/salesforce/) section. If you have further questions, contact [Glance Support](mailto:support@glance.net). --- ## Button and Record Errors **The connect button does nothing when I click it, how can I fix this?** If the JavaScript was successfully added to all the necessary pages on the website and a session was started on Chrome for a visitor in the Salesforce Community on a Mozilla browser in Stage by entering the Glance code into the G4SF add-on in Salesforce. But, when the Connect button is selected, nothing happens even though pop-ups are enabled, go through the following steps to resolve the issue. To resolve the issue, set up the Profile to have the appropriate permissions: 1. Navigate to the console and enter **Profiles** in the **Quick Find / Search** text box. 2. Select **Manage Users**. 3. Go to **Profiles** and locate the profiles that are assigned to the users of the Glance for Salesforce application. 4. Select the **Profile Name** and scroll down to the **Apps** section. 5. Click on the **Custom Permissions** to open the Glance permissions. 6. At the top of the Custom Permissions page, select the **Edit** button. 7. Ensure that there is only **one** `G4S.Glance for Salesforce _Enabled Custom Permissions_`- either **G4S.Glance for Salesforce** or **G4S.Glance for Salesforce - Panorama**. Make sure that it coordinates with the appropriate configuration for the client. **Glance Cobrowse activity record fails to be created?** To make sure that the activity record does not fail to be created, configure IE to trust the `https://*.glance.net` domain. --- ## Invalid HTML If the agent's view does not match the visitor's, it may be due to invalid HTML on the visitor's side, as it is possible to build and render a malformed HTML structure using JavaScript. In a Cobrowse session, the contents of the visitor's page are scanned, transmitted, and re-rendered in the agent's view. If the HTML has been constructed invalidly via JavaScript on the visitor's side, the agent's browser may attempt to correct it during rendering, potentially leading to visual mismatches between the visitor and agent. Common examples of invalid HTML that can cause mismatches include nested buttons, or placing a div element inside a p element. To see how browsers attempt to correct these issues, try rendering the following two HTML snippets in a browser and inspect the resulting DOM tree: **Invalid HTML will be corrected** ```html

This is a paragraph element in red

This is a div element in blue

``` **Invalid HTML constructed with JavaScript will not be corrected** ```html

This is a paragraph element in red

``` To determine if invalid HTML is causing the issue, try running `GLANCE.checkHTML()` and `GLANCE.runTroubleshooter()` from the visitor-side browser console. These tools scan for common types of invalid HTML but may not catch every issue. If no problems are reported, try comparing the visitor's DOM to the agent's, focusing on the point where the structures begin to diverge. ================================================================= FILE: /developer =================================================================

Developers

Tools, libraries, and guides to help you integrate Glance's co-browse and video capabilities directly into your web, mobile, and desktop applications.

## AI Assistance Building with Cursor, GitHub Copilot, or ChatGPT? Use our context file to train your AI session on Glance documentation instantly.
LLMS.TXT
https://docs.glance.net/llms.txt View File →
================================================================= FILE: /developer/integrations/agent_workspace/amazon ================================================================= Amazon Connect Integration Overview ## Prerequisites * All high-level prerequisites as listed in the [Getting Started](../agent_workspace/) section. * Access to an [Amazon Connect Instance](https://docs.aws.amazon.com/connect/latest/adminguide/tutorial1-set-up-your-instance.html). ## Add the Glance Application To incorporate the Glance Application in Amazon Connect: 1. Navigate to the Third-Party Applications section in Amazon Connect, and click **Add Application**. Add Application in Amazon Connect 2. Under **Basic Information**, input the following: * For **Display name**, enter "Glance". * For **Namespace**, enter "Glance". * Enter an optional description for the Glance application. Basic Information Configuration 3. Under the **Access** section, enter the following: * For **Access URL**, enter the URL provided by Glance. * For **Approved Origins**, enter `https://www.glance.net`, and the URL for your IDP environment, e.g. `https://.okta.com` Access URL and Approved Origins Configuration ## Joining Sessions from Amazon Connect 1. Navigate to the Agent Workspace application. 2. From the Agent Workspace, click the **Apps** menu and select the Glance application. Agent Workspace Apps Menu 3. You will be prompted to sign in to your Identity Provider. Log in with your credentials. 4. The Glance application is now available and you can join Glance Sessions. Glance Application Active in Amazon Connect ================================================================= FILE: /developer/integrations/agent_workspace/dynamics ================================================================= ## Prerequisites * All high-level prerequisites as listed in the [Getting Started](../agent_workspace/) section. ## Add the Glance Application The following steps describe how to embed Glance controls within the Customer Service Hub workstream. 1. Click the **Pages** tab. 2. Select the view and form to add the Glance controls (i.e., **Customers** -> **Contacts view** -> **Contacts form**) then click the pencil icon. Select view and form in Dynamics 3. Select the **Components** tab from the left menu, scroll down to the **Layout** section and drag **1-column tab** to the form on the right. 4. Rename the section to "Glance Collaboration". Rename section to Glance Collaboration 5. Scroll down to the **Display** section and drag **</> HTML web resource** into the **Glance Collaboration** section. Drag HTML web resource into section 6. Within **Add HTML web resource** click **+ New web resource**. Click New web resource 7. Create an HTML file containing an iframe, replacing "GLANCE URL" with the organization-specific URL provided by Glance. For example: ```html ``` 8. Click **Choose file** and upload the HTML file created in the previous step. Complete the rest of the form and click **Save**. Upload HTML file and Save 9. Click **Save and publish** in the upper right corner. If changes to the iframe are required, utilize the **Properties** panel on the right. Save and publish properties panel ## Joining a Session from Microsoft Dynamics 1. Navigate to the Dynamics Customer Service Hub. 2. Select either **Contacts** or **Cases** from the left navigation pane. 3. Click the **Summary** tab. 4. Log in with your credentials when prompted to sign in to your Identity Provider. Identity Provider login prompt in Dynamics 5. The Glance application is now available within the Glance Collaboration section. ================================================================= FILE: /developer/integrations/agent_workspace/five9 ================================================================= Five9 Integration Overview ## Prerequisites * All high-level prerequisites as listed in the [Getting Started](../agent_workspace/) section. * Access to a Five9 Instance, and access to the Virtual Contact Center (VCC) Admin Application. * You have created a campaign and associated skill for agents you want to utilize Glance. * You've added the following URLs to the Allowed Sites list: * In the Virtual Contact Center (VCC) application, navigate to **Actions > Configuration > Web > Web Sites Allowed to Access REST API (CORS)** section and add the following URLs: * Your IDP URL, e.g. `https://.okta.com` * The URL to the Generic Package, provided by Glance. * `https://www.glance.net` * `https://www.glancecdn.net` Allowed Sites configuration in Five9 VCC ## Add the Glance Connector to Five9 1. From the Virtual Contact Center (VCC) Admin Application, under the **Connectors** section, click the plus sign to create a new connector for Glance. 2. Enter a name and description. 3. For **URL**, enter the URL provided by Glance. 4. For **Method**, select **GET**. 5. For **Execution Mode**, choose **In Browser**. 6. For **CTI Web Services**, choose **Current browser window**. 7. Click **Save**. Add Glance Connector in Five9 VCC ## Joining Glance Sessions from Five9 1. Navigate to the Agent Desktop Application. 2. When logging in, select the skill you associated with Glance. 3. From the Agent Dashboard, select the Campaign where Glance is enabled. 4. When the interaction is started, you will be prompted to sign in to your Identity Provider to access the Glance application. Log in with your credentials. 5. The Glance application is now available and you can join Glance Sessions. Glance application active in Five9 Agent Desktop ================================================================= FILE: /developer/integrations/agent_workspace ================================================================= This section provides samples for integrating Glance into your agent workspace. The sample package provides an agent-side interface that enables agents to join [Glance Cobrowse](https://help.glance.cx/glance-cobrowse/) and [Mobile Cobrowse](https://help.glance.cx/mobile-app-sharing/) sessions, as well as use [Mobile Camera Share](https://help.glance.cx/mobile-camera/) functionality. ## Getting Started Before using the Glance agent-side experience, ensure the following prerequisites have been completed: * The organization has been provisioned a [Glance Group](https://help.glance.cx/account-management/manage_users/). * Users have been provisioned with valid Partner User IDs. * The website is tagged with the [Glance Cobrowse script](https://developer.glance.cx/glance-cobrowse/add_tag/), and includes a [button or link](https://developer.glance.cx/glance-cobrowse/create_link/) to start a Cobrowse session. * [SAML authentication](https://help.glance.cx/integrations/saml/saml_setup/) with Glance is enabled through an Identity Provider. * Onboarding with Glance Customer Success has been completed. As part of this process, Glance provides an organization-specific URL and configures an allow-list for the agent desktop. If you need assistance, [Contact Glance](https://help.glance.cx/account-management/contact/). ## Agent Interface Agent Workspace Interface The initial interface offers agents two options for connecting with a visitor: they can click the **Enter Key** button to start a Cobrowse session using a session key provided by the visitor, or click the **Camera Share** button to send an SMS link that allows the visitor to share their mobile phone camera. ### Join with Key Join with Key Interface Input the code received from the visitor and click the **Join** button. ### Camera Share Camera Share Interface Input the visitor's mobile phone number and click the **Send** button. To change the country code, click the flag icon and select the appropriate region from the list. ### Presence Presence Interface When Presence is enabled, you can instantly join the visitor's session by clicking the orange **Join** button. ================================================================= FILE: /developer/integrations/agent_workspace/twilio_flex ================================================================= Twilio Flex Integration Overview ## Prerequisites * All high-level prerequisites as listed in the [Getting Started](../agent_workspace/) section. * Access to a [Twilio Flex Instance](https://www.twilio.com/docs/flex), and have followed the steps to create a [Flex Plugin](https://www.twilio.com/docs/flex/quickstart/getting-started-plugin) through the tutorial. ## Adding Glance to a Flex Plugin 1. After following the tutorial for the Flex Plugin listed above, replace the code in the Bing example with the following code: ```javascript import React from "react" import { FlexPlugin } from "@twilio/flex-plugin" import CustomTaskList from "./components/CustomTaskList/CustomTaskList" const PLUGIN_NAME = "SamplePlugin" export default class SamplePlugin extends FlexPlugin { constructor() { super(PLUGIN_NAME) } /** * This code is run when your plugin is being started * Use this to modify any UI components or attach to the actions framework * * @param flex { typeof import('@twilio/flex-ui') } */ async init(flex, manager) { flex.CRMContainer.defaultProps.uriCallback = (task) => { return task ? `URL FROM GLANCE` : "URL FROM GLANCE" } } } ``` 2. [Deploy and release](https://www.twilio.com/docs/flex/quickstart/getting-started-plugin#deploy-your-flex-plugin) the plugin to your environment. ## Joining Glance Sessions from Twilio Flex 1. Navigate to the Twilio Flex Agent desktop. 2. The Glance application is available in the CRM container window. 3. You will be prompted to sign in to your Identity Provider to access the Glance application. Log in with your credentials. 4. The Glance application is now available and you can join Glance Sessions. Glance application active in Twilio Flex CRM container ================================================================= FILE: /developer/integrations ================================================================= Glance partners with your integrations team to deliver a seamless transition into your website, CCaaS, or CRM. Many of our customers get started with the Browser Agent SDK and are supported every step of the way by our dedicated Developer Experience (DevEx) team to ensure success. Glance has a proven track record of integrating with industry-leading platforms, including: - Salesforce - Amazon Connect - Microsoft Dynamics - Five9 - Twilio Flex - Genesys ================================================================= FILE: /developer/integrations/twilio_webchat ================================================================= Flex WebChat must be loaded from the CDN. Glance does not provide an NPM package, which is required for React deployments. 1. Install [Flex WebChat](https://www.twilio.com/docs/flex/developer/messaging/webchat/setup#option-1). 2. The following code example contains Flex WebChat and Glance Presence functionality. Update the code with your Account SID and Flex Flow SID: ```html ``` 3. Set up a [Flow](https://www.twilio.com/console/studio/flows) for Flex WebChat: 1. From the Twilio Console > **Studio** > **Manage Flows**, select **Webchat Flow**. 2. In the **Widget Library** > **Flow Control**, select and drag **Set Variables** onto the canvas. Click the widget to edit. 3. Click the plus sign on the right side of **Variables**. 4. For **Key**, input `glance_visitor_id`. 5. For **Value**, input `{{trigger.message.ChannelSid}}` 6. **Save** the variable. 7. **Save** the widget. 8. Wire the widget to the **Incoming Message Trigger**. 9. In the **Widget Library** > **Connect Other Products**, select and drag **Send to Flex** onto the canvas. Click the widget to edit. 10. For **Workflow**, select **Assign to Anyone**. 11. For **Channel**, select **Programmable Chat**. 12. For **Attributes**, input `{"name": "{{trigger.message.ChannelAttributes.from}}", "channelType": "{{trigger.message.ChannelAttributes.channel_type}}", "channelSid": "{{trigger.message.ChannelSid}}", "glance_visitor_id": "{{flow.variables.glance_visitor_id}}"}` 13. **Save** the widget. 14. Wire the widget to the **Set Variable Widget** that you just created. 15. Select **Publish**. Twilio Webchat Flow diagram ================================================================= FILE: /developer/legacy_api/activity ================================================================= The Activity Service API provides developers with programmatic access to historical session data, allowing you to seamlessly query session counts, detailed participant information, and overarching usage metrics. Implemented via Windows Communication Foundation (WCF), this versatile web service supports integration through SOAP/XML, JSON requests, and standard HTTPS POSTs, making it highly compatible with a wide range of backend reporting systems, custom dashboards, and CRM workflows. In this section, you will find a comprehensive reference for interacting with the Activity Service. This includes a breakdown of all available **Methods** and **Endpoints** (such as retrieving active, completed, or user-specific sessions), the global **Conventions** required for authentication and date formatting, and a detailed mapping of **Session and Guest Statuses** to help you accurately track the lifecycle of every cobrowse, screen share, and video interaction. ================================================================= FILE: /developer/legacy_api/activity/status ================================================================= Glance service is provided via Sessions. Each successful session has two or more Session Guests.
Note
Some methods in this API filter out sessions and guests in certain states. Also, note that the Glance subscriber participating in the session is treated as a session guest in this API.
These are possible session status values, described in detail in the next section: * **A** - Active, both sides have joined (host/guest or agent/visitor) * **C** - Completed (session has ended) * **D** - Guest declined a view session during Screenshare * **E** - Problem connecting to the Cobrowse Asset Management (CAM) Service * **J** - Session is being set up, and is waiting for a cobrowse or screenshare server * **L** - Locked * **Q** - Quit. Session was Waiting, but was ended by host or visitor before other side joined * **T** - Timed out. Session was Waiting but other side did not join within timeout * **U** - The session was ended in an unknown state * **W** - Waiting, other side has not joined yet * **X** - Completed (session ended but without a clean close) ## A - Active An active session is one that is in use by a Glance subscriber and one or more other guests. After use, every **A** session will transition to become a **C** session or **X** session. ## C - Completed and X - Completed Upon completion, each **A** session becomes either a **C** session or **X** session. Sometimes session guests (including Glance subscribers and website visitors) end their **A** sessions by closing their browser windows or disconnecting from the network. When that happens, a session may become an **X** session because it did not end with a "clean close" by using Glance's session ending protocol. * Sometimes **A** sessions end when a guest requests the end of the session. Those sessions become **C** sessions. * Both **C** and **X** sessions represent a successful interaction. * **C** sessions and **X** sessions do not transition to any other state. ## J - Session is being set up Newly-created sessions have this status. A session is created at the time a website visitor initiates a cobrowse session, or when a Glance subscriber starts a screenshare or video session. ## L - Locked A very few screenshare sessions get into the **L** state, and no cobrowse sessions. This state is part of Glance's way of preventing multiple sessions from different host machines for the same subscriber. **L** sessions do not transition to any other state. ## Q - Quit Sometimes the originator of a session�screenshare host or cobrowse website visitor�ends a session before any other session guest joins. That makes the **W** session become a **Q** session. **Q** sessions do not transition to any other state. ## T - Timed Out **W** sessions cannot remain **W** sessions forever. If no second guest joins the session, it eventually times out and becomes a **T** session. Screenshare and video sessions take ten minutes to time out. Cobrowse sessions take two minutes to time out. **T** sessions do not transition to any other state. ## W - Waiting **W** sessions are completely set up. Each **W** session has one guest: the originator. It is waiting for other guests to connect. In the case of a cobrowse session, typically the **W** status means that the web site visitor is waiting for an agent to connect. But, if a website visitor inadvertently starts a session (by pressing a hotkey or clicking a cobrowse link, for example) the session will enter the **W** state, and then will transition either to the **Q** or **T** state when the user stops the session or when it times out. So, not all **W** states mean a website visitor is waiting for an agent to respond. In the case of screenshare or video sessions, the **W** status means the session has been initiated by the host and is waiting for guests to join. Every **W** session will transition to become an **A** session, **Q** session, or **T** session. ## Session Status Flow Chart Below is a flow chart displaying how a session can progress through the various statuses: Flow chart displaying how a session can progress through the various statuses ## Session Guest Status These are possible guest status values: * **A** - Active (guest connected) * **C** - Completed (guest has left) * **D** - Guest declined the session * **E** - Unexpected error occurred * **J** - Joining (guest is in process of connecting but has not yet connected) * **P** - Another viewer instance was opened by the same guest * **R** - Temporary status that occurs when the server is waiting for a reconnect from the client * **T** - Session timed out * **W** - Temporary status that occurs when a different display side has connected but updates are not yet being sent * **X** - Guest left session, by closing a browser window or dropping the session some other way ================================================================= FILE: /developer/legacy_api/activity/webservices_activity ================================================================= This is the API for querying for session counts and session and participant details. **Endpoint:** `https://www.glance.net/services/activityservice.asmx` The WSDL is located here: `https://www.glance.net/services/activityservice.asmx?WSDL`
Note
Some operations are strictly for use with specific third-party integrations and are not documented in this generic reference.
## Output Values Many Activity Service operations return session records. Here is a description of the output values: | Value | Description | | :--- | :--- | | **Session Type** | Session type is one of "C" (cobrowse), "G" (Glance screen sharing), or "V" (video). | | **Session Status** | A single letter describing the state of a session. See [Session Status and Session Guest Status](./status) for status details.

Common session status values are:
  • W: Waiting, other side has not joined yet
  • A: Active, both sides have joined (host/guest or agent/visitor)
  • C: Completed (session has ended)
  • X: Session ended but without a clean close (may have dropped)
  • T: Timed out. The session was waiting but the other side did not join within the timeout
  • Q: Quit. The session was waiting but was ended by the host or visitor before the other side joined

Note: Some API methods filter out sessions with certain status values. Not every method returns sessions with all these status values. | | **Width and Height** | The initial width and height of the screen are returned for a screen-sharing session. This can change during a session if the display side changes its monitor or resolution. These values are 0 for co-browsing sessions.

For video sessions, the width and height represent the video resolution. The exact resolution depends on the originating person's webcam make, model, and settings. Video sessions always have a fixed ratio of 4:3 (NTSC), 11:9 (PAL), or less commonly 5:4 or 16:9 (HD) and usually have one of these sets of dimensions:
  • 160x120
  • 176x144
  • 320x240
  • 352x288
  • 640x360

A larger video resolution�such as 640x480 or 704x576�usually means the webcam is misconfigured. | | **Session Duration** | Session duration is in seconds. It is 0 for active sessions. | | **Guest Type** | Guest type is one of:
  • Agent: Agent (Glance user) in a Cobrowse session
  • Visitor: Website visitor (customer) in a Cobrowse session
  • Host: Glance user who has started a screen-sharing session
  • Guest: Guest of a screen-sharing session
| | **Guest Status** | Guest status is one of:
  • J: Joining (the guest is in the process of connecting but has not yet connected)
  • A: Active (guest connected)
  • C: Completed (guest has left)
  • X: Guest left the session, but without a clean close (may have dropped)

See [Session Status and Session Guest Status](./status) for more details. | | **Guest Duration** | Guest duration is in seconds. It is 0 for active guests. | | **Guest Information** | Guest information may include name, email, and phone if supplied. These values can be requested from the guest or passed through a URL used to join the session. Glance gathers this information on behalf of Glance customers and only at their request. If a customer account is not configured to gather this information, these values are empty.

Guest information may also include a location node with city, region (state/province), and country code. This is derived from the guest's IP address if available. | ### Sample Session Records (XML) ```xml 12423680 C C 2016-02-23T22:17:51Z 6684 0 0 147 false visitor C 2016-02-23T22:17:22Z 147 108.49.96.66 iOs 3 3 Newburyport MA US agent C 2016-02-23T22:17:51Z 118 66.78.234.123 Alexandria VA US 12442276 G C 2016-02-24T21:12:09Z 7734 1920 1080 259 false host C 2016-02-24T21:11:42Z 259 108.49.96.66 Newburyport MA US guest C 2016-02-24T21:12:09Z 244 66.78.234.123 Alexandria VA US Greta Guest sales@glance.net 781-646-8505 Session ended by other side ``` ### JSON Requests Calls may also be made passing JSON parameters and returning JSON results. In order to make a JSON format call, make a `POST` request with a `Content-Type` header set to `application/json`. The parameters are passed in a JSON format object in the post data. **Sample Curl Example** ```bash curl -X POST [https://www.glance.net/services/activityservice.asmx/PartnerCompletedSessions](https://www.glance.net/services/activityservice.asmx/PartnerCompletedSessions) -H 'Content-Type:application/json' -d '{"partnerId":12345,"apiKey":"ABCDeF_G12TOFEkzzz","startRange":"2023-02-23T22:00:00Z","endRange":"2023-02-28T22:00:00Z","sessionKey":"","nResults":10,"nextId":0}' ``` **Sample JSON Results** ```json { "d": { "__type": "ActivityService+groupSessions", "nextId": 123456789, "users": [ { "__type": "ActivityService+userSessions", "userName": "agent.company.glance.net", "partnerUserId": "puidValue", "validUser": true, "invalidReason": null, "sessions": [ { "__type": "ActivityService+session", "id": 56960588, "type": "V", "status": "C", "startTime": "2020-02-12T11:41:12Z", "key": "9900V51849", "width": 176, "height": 144, "duration": 13, "kbytes": 0, "isReverse": false, "guests": [ { "type": "", "status": "X", "startTime": "2020-02-12T11:41:14Z", "duration": 11, "kbytes": 0, "ip": "209.255.163.147", "location": { "city": null, "region": null, "countryCode": "US" }, "name": null, "email": null, "phone": null }, { "type": "", "status": "X", "startTime": "2020-02-12T11:41:18Z", "duration": 11, "kbytes": 0, "ip": "209.255.163.147", "location": { "city": null, "region": null, "countryCode": "US" }, "name": null, "email": null, "phone": null } ] } ] }, { "__type": "ActivityService+userSessions", "userName": "agent2.company.glance.net", "partnerUserId": "anotherPUID", "validUser": true, "invalidReason": null, "sessions": [ { "__type": "ActivityService+session", "id": 57125147, "type": "C", "status": "C", "startTime": "2020-02-13T18:34:18Z", "key": "1111", "width": 0, "height": 0, "duration": 9, "kbytes": 30, "isReverse": false, "guests": [ { "type": "visitor", "status": "C", "startTime": "2020-02-13T18:34:15Z", "duration": 9, "kbytes": 30, "ip": "208.253.26.138", "location": { "city": "Seekonk", "region": "MA", "countryCode": "US" }, "name": "Test guy", "email": "jsmith@email.net", "phone": "314-555-1212" }, { "type": "agent", "status": "C", "startTime": "2020-02-13T18:34:18Z", "duration": 6, "kbytes": 18, "ip": "208.253.26.138", "location": { "city": "Seekonk", "region": "MA", "countryCode": "US" }, "name": null, "email": null, "phone": null } ] } ] } ] } } ``` ================================================================= FILE: /developer/legacy_api/activity/webservices_conventions ================================================================= This document describes various Glance Web Services APIs, which return information on your Glance sessions and participant details. The APIs in general can be called via SOAP/XML or JSON requests. Calls may also be made via HTTPS POSTs, returning XML results. These APIs are implemented using Windows Communication Foundation (WCF) and may be consumed by any compatible software. Information on retrieving authentication information for a particular username is available [here](https://help.glance.cx/integrations/login-key/login_check/). ## General Conventions | Convention | Description | | :--- | :--- | | **Partner ID / API Key** | Most operations authenticate with a `partnerId` and `apiKey`. The `partnerId` is the same as your Glance Group ID. This is assigned by Glance. The API Key can be set, reset, and viewed by an Administrator logged into the Glance My Account area under Settings. You must store this value securely. | | **PartnerUserId** | Operations that specify a particular Glance user will usually take a `PartnerUserId`. This is a value Glance can store for a user containing your unique user identifier for the user (any string of up to 255 characters). It is usually set by provisioning users with the Partner API or from a CSV file upload in the online Partner Portal. | | **Date Values** | Date values can be specified as [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) or local time in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format:

  • 2012-12-01T16:08:00Z: UTC date and time
  • 2012-12-01T16:08:00-5:00: Time with offset from UTC
  • 2012-12-01T16:00:00: Unspecified timezone = US East Coast time (EST or EDT)
  • 2012-12-01: Time 00:00, midnight at the beginning of Dec 1, 2012, East Coast time

Note: Date values are returned in [UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time). | ================================================================= FILE: /developer/legacy_api/activity/webservices_operations ================================================================= ## PartnerSessionCounts `https://www.glance.net/services/activityservice.asmx?op=PartnerSessionCounts` This method returns counts of numbers of sessions started within the given date range, broken down by session type and status. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | | **type** | Parameter must be supplied, but value is optional. **"C"** Cobrowse, **"G"** Screen Share, or **"V"** Video (blank returns all). | | **status** | **"A"** Active or **"C"** Completed sessions. | | **startRange**
**endRange** | Date range of session starting times.

For today's sessions, set startRange to today and endRange to tomorrow.

The maximum range is 31 days. | **Sample Results** ```xml C C 141 748 C Q 2 106 C T 24 127 C X 2 905 G C 123 619 ``` ## PartnerSessionCountsEnding `https://www.glance.net/services/activityservice.asmx?op=PartnerSessionCountsEnding` This method returns counts of numbers of sessions **ended** within the given date/time range, broken down by session type and status. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | | **type** | Parameter must be supplied, but value is optional. **"C"** Cobrowse, **"G"** Screen Share, or **"V"** Video (blank returns all). | | **startRange**
**endRange** | Date range of session starting times.

For today's sessions, set startRange to today and endRange to tomorrow.

The maximum range is 31 days. | **Sample Results** ```xml C C 2 40 C Q 3 8 C T 2 125 ``` ## PartnerActiveSessions `https://www.glance.net/services/activityservice.asmx?op=PartnerActiveSessions` This method returns essentially the list in the Glance Account Activity tab: an array of all currently Active or Waiting sessions for all users in your Glance Group (organization). It does not return all session fields or detail guest information, but that can be retrieved for a specific session with `PartnerUserSessions` (see below). An Active (**A**) session has at least one each of Agent/Host and Visitor/Guest connected. A Waiting (**W**) session has been started and is still waiting for the other party to join. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | **Sample Results** ```xml 61943691 C A 2020-03-31T20:13:58Z 1281 false demo.glance.net Jack Demo JDemo 2 ``` ## PartnerCompletedSessions `https://www.glance.net/services/activityservice.asmx?op=PartnerCompletedSessions` This method returns a list of completed sessions started within the date/time range, grouped by user. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | | **startRange**
**endRange** | Date range of session starting times.

For today's sessions, set startRange to today and endRange to tomorrow.

The maximum range is 31 days. | | **sessionKey** | Parameter must be supplied, but value is optional. If supplied, then only sessions with that key are returned. | | **nResults** | Number of sessions to return in this call, must be between 1 and 1000. | | **nextId** | Next starting id for pagination of results. For the first (or a single) call pass 0. On subsequent calls, pass the value returned by the previous call. | **Sample Results** ```xml 61943153 demo.glance.net JDemo true 61874627 C C 2020-03-31T12:43:12Z example 0 0 7 33 false visitor C 2020-03-31T12:43:09Z 7 33 12.345.678.910 Boston MA US agent C 2020-03-31T12:43:12Z 4 23 12.345.678.910 Boston MA US ``` ## PartnerCompletedSessionsEnding `https://www.glance.net/services/activityservice.asmx?op=PartnerCompletedSessionsEnding` This method is the same as `PartnerCompletedSessions` except it returns a list of completed sessions **ended** within the date/time range. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | | **startRange**
**endRange** | Date range of session starting times.

For today's sessions, set startRange to today and endRange to tomorrow.

The maximum range is 31 days. | | **sessionKey** | Parameter must be supplied, but value is optional. If supplied, then only sessions with that key are returned. | | **nResults** | Number of sessions to return in this call, must be between 1 and 1000. | | **nextId** | Next starting id for pagination of results. For the first (or a single) call pass 0. On subsequent calls, pass the value returned by the previous call. | **Sample Results** ```xml 61943153 demo.glance.net JDemo true 61874627 C C 2020-03-31T12:43:12Z example 0 0 7 33 false visitor C 2020-03-31T12:43:09Z 7 33 12.345.678.910 Boston MA US agent C 2020-03-31T12:43:12Z 4 23 12.345.678.910 Boston MA US ``` ## PartnerUserSessions `https://www.glance.net/services/activityservice.asmx?op=PartnerUserSessions` This method returns a list of sessions for a particular user. **Input Parameters** | Parameter | Description | | :--- | :--- | | **partnerId** | Your Glance group id. This is assigned by Glance. | | **apiKey** | The unique identifier used to authenticate. Administrators can set, reset, and view API keys from the My Account area under Settings. | | **partnerUserId** | User whose session(s) are retrieved. | | **startRange**
**endRange** | Date range of session starting times.

For today's sessions, set startRange to today and endRange to tomorrow.

The maximum range is 31 days. | | **status** | Must be either "A" to return Active (in-progress) sessions or "C" for Completed sessions. | | **sessionKey** | Parameter must be supplied, but value is optional. If supplied, then only sessions with that key are returned. |
Note
The partnerUserId can be assigned by Glance, but will typically be supplied by you, if you provision users with the Glance Provisioning API. For more information on provisioning, contact Glance support.
**Sample Results** ```xml true 61943691 C C 2020-03-31T20:13:58Z 1281 0 0 687 28 false visitor C 2020-03-31T20:13:54Z 687 28 12.345.678.910 Boston MA US agent C 2020-03-31T20:13:58Z 683 19 12.345.678.910 Boston MA US ``` ================================================================= FILE: /developer/legacy_api/auth ================================================================= Glance Authorization Services provide robust tools for securely managing agent access and monitoring live interactions. Using the **Authorization Web Service**, developers can generate JSON Web Tokens (JWTs) via SOAP, REST, or the client-side JavaScript API to securely authenticate agent-side requests and enforce group-specific privileges. Once your agents are securely authenticated, the **SessionService Web Services API** offers a straightforward interface�accessible via SOAP/XML, JSON, or standard HTTPS POSTs�to query real-time information about sessions currently in progress, ensuring your custom dashboards and support workflows stay securely synchronized with live activity. ================================================================= FILE: /developer/legacy_api/auth/webservices_authorization ================================================================= All agent-side requests to the Presence Service carry an Authorization Token which can be obtained from the Glance Authorization Web Service. Glance uses the JSON Web Token (JWT) standard for creating, signing, and verifying authorization tokens. A valid JWT: * Guarantees that the agent has been authenticated by Glance. * Indicates the specific privileges that the agent has. If an agent is a member of multiple groups, bear in mind that the token is always group-specific. To carry out an API operation in a particular group, the agent needs an Authorization Token for that specific group.
Warning
Authorization is resource-intensive. To prevent performance problems, reauthorize only when the previously issued token expires. See the Presence Security Whitepaper for additional information on the Authorization Token.
## Glance Authorization Web Service An authorization token may be obtained server-side using the Glance Authorization Service SOAP or REST API. * For the SOAP WSDL, see: `https://www.glance.net/services/AuthorizationService.svc` * For the REST help documentation, see: `https://www.glance.net/services/AuthorizationService.svc/rest/help` All credential properties are optional, but one of the following combinations must be specified: * `username` and `password` * `username` and `g4scredentials` * `username` and `loginkey` * `gssnid` * `partnerid`, `partneruserid`, `loginkey` ### Providing the Authorization Token to the GLANCE JavaScript APIs The Authorization Token may be specified in metadata by adding the HTML attribute `data-authtoken="[authorizationtoken]"` to the cobrowse script tag as follows: ```html ``` If you are including the presence script bundled in a component or self-hosted, you must add a meta tag to specify the group id: ```html ``` The Presence Agent API can only be used from a trusted domain.
Warning
Contact Glance to ensure that your website domain is configured as an allowed agent origin on our Presence Service.
### Authorization The Presence Agent API requires an Authorization Token which can be obtained from the Glance Authorization Service web service. Authorization should be performed once to obtain a token which can be used for a set duration. Please refer to the Glance [Authorization API](/webservices/auth/webservices_authorization) for information on obtaining and using an Authorization Token. The Glance Presence Agent API is defined in the namespace `GLANCE.Presence.Agent`. --- #### GLANCE.Presence.Agent(params) - constructor Constructs a Presence agent object. A separate agent object must be instantiated for each visitor that the agent needs to communicate with. Either a `visitorid` or a `uniqueid` must be specified in the params object to identify the visitor connection. #### Parameters ```json { "presenceserver": "Presence Service, defaults to presence.glance.net", "visitorid":"", // specify visitor id for a visitor connected with GLANCE.Presence.Visitor.connect() "uniqueid":"" // specify unique id for a visitor connected with GLANCE.Presence.Visitor.connectUnique() } ``` --- #### GLANCE.Presence.Agent.prototype.lookupVisitor(params) ```json { "onsuccess": "function(visitordata)", "onfail": "function(reason)" } ``` **visitordata example payload:** *Visitor on web:* ```json { "url": "[https://www.glancedev1.com/joeb/cyv/chooseyourvisitor.html?%7B%22visitorId%22%3A%22example%22%2C%22groupId%22%3A%2220541%22%2C%22additionalGroupIds%22%3A%22%22%2C%22presenceSetting%22%3A%22on%22%2C%22environment%22%3A%22staging%22%2C%22website%22%3A%22%22%2C%22cdn%22%3A%22www.glancecdn.net%22%2C%22videoAtStart%22%3A%22default%22%2C%22dataCollection%22%3A%22off%22%2C%22autoLoad%22%3A%22no%22%2C%22startPaused%22%3A%220%22%2C%22selfHosted%22%3A%22%22%7D](https://www.glancedev1.com/joeb/cyv/chooseyourvisitor.html?%7B%22visitorId%22%3A%22example%22%2C%22groupId%22%3A%2220541%22%2C%22additionalGroupIds%22%3A%22%22%2C%22presenceSetting%22%3A%22on%22%2C%22environment%22%3A%22staging%22%2C%22website%22%3A%22%22%2C%22cdn%22%3A%22www.glancecdn.net%22%2C%22videoAtStart%22%3A%22default%22%2C%22dataCollection%22%3A%22off%22%2C%22autoLoad%22%3A%22no%22%2C%22startPaused%22%3A%220%22%2C%22selfHosted%22%3A%22%22%7D)", "browser": "edge", "browserver": 137, "platform": "mac", "directserver": "prod-presence-1.glance.net", "httpsport": "443", "visitorid": "example", "groupid": "12345" } ``` *Visitor on Mobile SDK:* ```json { "directserver": "prod-presence-1.glance.net", "httpsport": "443", "visitorid": "example", "groupid": "12345" } ``` --- #### GLANCE.Presence.Agent.prototype.signalVisitor(params) Sends a signal (message) to a visitor who has been connected within the last 5 seconds to the service. If the visitor has an open connection to the service, the visitor will be signaled immediately. Otherwise, the visitor will be signaled on next connect, if within 5 seconds. The `onsuccess` callback is called when the signal is confirmed that it was received by the Presence service. #### Parameters ```json { "data" : "message to send to visitor", "onsuccess" : "function to be called back on success", "onfail" : "function to be called back on failure" } ``` The visitor receives the signal via the `onsignal` event. --- #### GLANCE.Presence.Agent.prototype.invokeVisitor(params) Invokes a visitor side JavaScript function in the `GLANCE` namespace. Visitor side must have been connected at some point within the last 5 seconds. The `onsuccess` callback is called when the invoke message is confirmed that it was received by the Presence service. #### Parameters ```json { "func" : "name of function to invoke, must be in the GLANCE namespace", "args" : "object to pass to the function", "onsuccess" : "function to be called back on success", "onfail" : "function to be called back on failure" } ``` --- #### GLANCE.Presence.Agent.query(params) Queries Presence data `// not implemented yet` --- #### GLANCE.Presence.Agent.prototype.connect(params) Connect to the Presence server to receive notification of events related to the visitor. `connect()` opens a WebSocket connection to the Presence service. Before calling `connect()`, set event handlers as properties of the Agent object. --- #### GLANCE.Presence.Agent.prototype.disconnect() Disconnect the Presence Agent from the presence service. Once disconnected, the agent will no longer receive notifications about events happening on the visitor side. --- ### Agent Events Events which may fire on the agent side are: | Event | Data Passed | Description | | :--- | :--- | :--- | | `onvisitorconn` | `{ "connected" : true/false }` | Fires when a visitor connects or disconnects from the presence service. Note that for a visitor browsing a website, the actual websocket connection will disconnect and reconnect as the visitor navigates from page to page. The visitor is still considered connected to presence during navigation, so no "visitorconn" event fires. | | `onvisitorsock` | `{ "connected" : true/false }` | Fires when the visitor's actual socket or websocket connection to the presence server is established or closed. | | `onpresence` | `{ presence_data_object }` | The presence data just sent by the visitor. | | `onerror` | `{ "error" : "error_code", "detail" : "error_detail" }` | **Error codes**:
**connfail** - Failed to establish or maintain the websocket connection. In the event of a connection failure, a "detail" property will include a detailed reason:
**authfail** - Authorization token missing, bad, or expired
**connection** - Network connection dropped
**error** - Server returned an error
**invalidprotocol** - Visitor IDs contain special nats characters: space, *, and >. | | `onterms` | `{ status : "displayed/accepted/declined" }` | The terms event fires when the terms and conditions dialog is displayed, accepted, or declined by the visitor. | | `onvisitorsessionstart`, `onvisitorsessionend`, `onvisitorerror` | *N/A* | These events fire when the corresponding events sessionstart, sessionend, and error fire on the visitor side. See the `GLANCE.Cobrowse.Visitor` API documentation for details. | | `onvisibility` | `{ visibility : "hidden/visible" }` | The visibility event fires when the visitor's browser tab visibility changes. | --- ### Error Handling The `onfail` parameters to `GLANCE.Presence.Agent` methods should be a function which takes a "reason" parameter. The "reason" codes will be one of the following: * **authorization** - Authorization token missing, bad, or expired * **connection** - Network connection could not be established. See the browser console for details. ## Sample Code See [Sample Code](./sample) for details. ================================================================= FILE: /developer/presence/presence_rest_api ================================================================= # Presence Agent REST API The Glance Presence Agent REST API offers the same functionality as the JavaScript `GLANCE.Presence.Agent` API, with the exception of `connect()` which relies on WebSockets. The REST API is useful for implementing server side agent console functionality. ### REST API URLs The Presence service consists of a load balancer at `presence.glance.net` as well as multiple named Presence Servers at `presence0001.glance.net`, `presence0002.glance.net`, etc. Presence data can be queried by invoking the JSON REST API on the Presence Service at `presence.glance.net`. Signaling specific visitors must be done by finding the instance that the visitor is currently connected to (via `/findvisitor`), then invoking the REST API on that specific server. ### Authorization All Presence Agent REST API entry points expect an authorization token to be sent in an HTTP `Authorization` header as follows: ```text Authorization: Bearer [authorization_token] ``` The Authorization Token can be obtained using the Glance [Authorization API](/webservices/auth/webservices_authorization). *** ### REST API Endpoints The Presence service supports the following REST endpoints: #### /lookupvisitor Returns the Presence information for a particular visitor. ```text GET [https://presence.glance.net/lookupvisitor?groupid=](https://presence.glance.net/lookupvisitor?groupid=)[groupid]&visitorid=[visitorid] ``` **Response:** ```json { "direct": "pr0016.glance.net:443", "visitorpresent": "1583953702.0", "timestamp": "1583953702.0", "visitorid": "example", "groupid": "12345", "ds": "pr0016.glance.net/0", "directserver": "pr0016.glance.net", "tlsport": 5501, "httpsport": 443 } ``` #### /findvisitor Returns the specific named Presence server that the visitor is currently connected to. ```text GET [https://presence.glance.net/findvisitor?groupid=](https://presence.glance.net/findvisitor?groupid=)[groupid]&visitorid=[visitorid] ``` **Response (Visitor Found):** ```json { "ds": "pr0016.glance.net/0", "direct": "pr0016.glance.net:443", "directserver": "pr0016.glance.net", "tlsport": 5501, "httpsport": 443, "visitorfound": true } ``` **Response (Visitor Not Found):** ```json { "visitorfound": false } ``` #### /signalvisitor Signals the specified visitor, passing a JSON message. There must be a connected `GLANCE.Presence.Visitor` instance on the visitor side to receive the signal. ```text POST https://[directserver]/signalvisitor?groupid=[groupid]&visitorid=[visitorid] ``` The body of the request is the JSON message to send. The message should have the following format: ```json { "mtype": "message_type", "data": "message_payload" } ``` The message type can be `"invoke"`, to invoke a `GLANCE` JavaScript function on the visitor: ```json { "mtype": "invoke", "data": { "func": "GLANCE.Cobrowse.Visitor.startSession" } } ``` Alternatively, message type `"signal"` can be specified to send a custom message. When the visitor side receives the message, the event handler `onsignal()`, if defined, will be called on the Visitor instance. For example: ```json { "mtype": "signal", "data": { "command": "startchat", "chatid": "56789" } } ``` This will result in `onsignal({ "command": "startchat", "chatid": "56789" })` being called on the `GLANCE.Presence.Visitor` instance. ================================================================= FILE: /developer/presence/presence_security ================================================================= The Presence Service allows an authorized agent to invoke JavaScript functionality in a visitor browser. This document outlines the security considerations associated with the Presence Service. When an agent issues a request to the Glance Presence Service, the service verifies the identity of the agent, and ensures that particular agent is authorized to carry out the requested operation. This verification is accomplished by means of an Authorization Token. ## Authorization Token All agent side requests to the Presence Service carry an Authorization Token which can be obtained from the Glance Web Service. Glance uses the JSON Web Token (JWT) standard for creating, signing, and verifying authorization tokens. ## Obtaining the Token For an Agent to obtain an authorization token for Presence: 1. The Agent passes credentials to the Glance Authorization Service to prove their identity. 2. The Glance Authorization Service verifies the agent's credentials and determines whether the Agent is authorized to access the Presence service. The Glance Authorization Service is accessible via: * Soap 1.2 ([wsdl](https://www.glance.net/services/AuthorizationService.svc?wsdl)) * JSON REST ([REST help page](https://www.glance.net/services/AuthorizationService.svc/rest/help)) * XML REST ## Authentication The Glance Authorization service accepts as credentials any of the following: * Glance username and password * Partner ID, partner user ID, and login key * Glance username and login key * Glance website session id In addition to credentials, the agent must specify a Glance group id. An individual user may be a member of multiple groups, but at any given time the user authenticates in a particular group. If an agent needs to carry out operations in multiple groups, they must obtain multiple authorization tokens. ## Authorization Agents must have a current subscription which includes the Presence feature in order to be granted access to Presence services. ## Token Duration The agent specifies a duration for the token. Tokens may be issued for up to two hours duration. Obtaining a token is resource intensive. Therefore, the agent console should obtain a token and reuse it until it expires or the agent logs out, rather than obtaining a new token for every operation. ## Token Storage and Usage The authorization token may be obtained server side using the SOAP or REST API. It may be stored server side, for example in session state, and used in subsequent server side requests to the Presence service. Alternatively, a token obtained server side may be used client side by the Presence JavaScript API. The token may be embedded in the page in a `data-authtoken` attribute of the cobrowse script or meta tag, or it may be passed into the JavaScript API using `GLANCE.Authorization.setToken()`. Finally, a token may be obtained client side by passing credentials into `GLANCE.Authorization.authorize()`. When `setToken()` or `authorize()` is used, the authorization token is stored in local storage to allow reuse. All calls to the `GLANCE.Presence` API will automatically use the stored token, as long as those calls are made from secure pages on the same fully qualified domain. See the [Glance Authorization API](/webservices/auth/webservices_authorization) documentation for more information. --- ## Presence Service Request Validation ### Validating Authorization Token The Presence Service validates the authorization token presented: * In the `Authorization` header, for REST requests. * In the first message on a websocket connection. The Presence Service verifies the token signature, that it is not expired, and that the `groupid` in the token matches the `groupid` in the request. There are no restrictions on which visitors in the group the agent can interact with. ### Origin Check and CORS Requests to the Presence Service from secure browsers will include an `Origin` header. The Presence Service will reject requests with a non-whitelisted Origin domain. If and only if the request Origin is on the whitelist, the Presence Service will respond with the `Access-Control-Allow-Origin` header set to the Origin domain. ### Shared Secret JSON Web Tokens require a shared secret between the token issuer and the consumer. The Presence service generates a new shared secret every two hours and passes it to the Glance Authorization service via an https request to an internal endpoint in the Glance VPN. ### Visitor Authentication Website visitors are identified by a unique visitor id, which may be anything unique to the visitor such as a user id, phone number, or email address, which could either be relayed to a customer service agent over the phone, or is included in a customer record that can be retrieved using some information that is relayed over the phone. When the visitor id is not secret or is static, a customer service agent may want some way to guarantee that the visitor browser receiving any presence requests is truly operated by the individual on the phone. One way to do this would be for the agent console to trigger a confirmation message to appear on the visitor side. The visitor must select the correct button on the confirmation message (as directed by the agent over the phone) before subsequent presence requests can be sent. It is still the responsibility of the agent to verify the identity of the caller. ================================================================= FILE: /developer/presence/presence_visitor ================================================================= ## 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. ### Visitor ID A unique `visitorid` is required when connecting to presence. The visitorid can be specified in the `GLANCE_COBROWSE` JavaScript variable, or in `data-` attributes, as described on the [Cobrowse Visitor API](/webservices/visitor_agent/visitor/#cobrowse-visitor-api) page. For example: ```html ``` --- #### GLANCE.Presence.Visitor(params) - Constructor Constructor for a Visitor Object. **Parameters** ```javascript { "groupid" : "group_id", // defaults to GLANCE_COBROWSE.groupid "visitorid" : "visitor_id" // defaults to GLANCE_COBROWSE.visitorid } ``` Do not specify a `visitorid` if the visitor will connect using `connectUnique()`. See this page for more information on [Glance Cobrowse](/webservices/visitor_agent/visitor/#glance_cobrowse). --- #### GLANCE.Presence.Visitor.prototype.presence(params) Sends Presence information to the Presence service. **Parameters** ```javascript { "data": "custom data to be stored on the presence server" // optional } ```
Info
Data must be a JavaScript object whose properties are of type string or number.
The first time `presence()` is called after a new page is loaded, general visitor information such as URL and browser are sent to the Presence service, as well as any user specified information. On subsequent calls to `presence()`, any new Presence information provided will be merged with any existing information already on the server. --- #### GLANCE.Presence.Visitor.instance `GLANCE.Presence.Visitor.instance` is set to the most recently instantiated `GLANCE.Presence.Visitor` object. This allows multiple scripts running on a page to share a single Visitor instance. --- #### GLANCE.Presence.Visitor.prototype.connect() Connect to the Presence service to listen for Presence events related to the visitor. Behind the scenes, this method opens a websocket connection to a specific Presence server. If the Presence server instance shuts down due to an auto scaling event, the Visitor object automatically connects to a new Presence server instance. `connect()` must be called on the visitor side in order to receive commands from the agent, for example if the agent calls `signalVisitor()` or `invokeVisitor()`. If the visitor navigates to a new page, `connect()` must be called again to reestablish the connection. If the visitor is not connected at the time an agent signals or invokes the visitor, the visitor will receive the message upon next connection. If a new visitor connection is opened with the same visitor id, for example because the visitor opened a new browser tab to the same website, or switched from the website to a desktop application, the second connection takes focus and the first connection is sent a "blur" message. --- #### GLANCE.Presence.Visitor.prototype.connectUnique() Open a unique connection to the Presence service. A unique connection may be used in a scenario where a predetermined visitor id is not known to both visitor and agent. A unique connection differs from a non-unique connection in that: * The Presence Service assigns a 6 digit unique id (see the `onunique` event) * A unique connection times out after 5 minutes * Once a unique connection is established, no other connection can be made with the same unique id --- #### GLANCE.Presence.Visitor.prototype.disconnect() Disconnect the Presence Visitor from the Presence service. --- #### GLANCE.Presence.Visitor.prototype.extendUnique() Extends the timeout for an already open unique connection by another 5 minutes. --- #### GLANCE.Presence.Visitor.prototype.getVisitorId() Returns the visitor ID being used for the presence connection. If no visitor ID is defined, it will return an empty string. --- #### GLANCE.Presence.Visitor.prototype.isconnected() Returns `true` if connected to the presence service. Otherwise, `false`. --- #### GLANCE.Presence.Visitor.prototype.setVisitorId(visitorid) Change the visitor ID. If the presence instance is already connected to the Presence Service, calling `setVisitorId()` will disconnect and reconnect using the specified visitor ID. --- #### GLANCE.Presence.Visitor.setVisitorId(visitorid) Change the Visitor ID for the most recently constructed `GLANCE.Presence.Visitor` instance.
Warning
When using 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.
--- ### Visitor Events Before calling `connect()`, add event handlers as properties on the Visitor instance. Supported events are: | Event | Description | | :--- | :--- | | `onconnected` | Fires when a connection to the presence service is established. | | `onerror` | See `Glance.Presence.Agent` onerror event. | | `onsignal(data)` | `onsignal` fires when the agent sends a message via `signalVisitor({ "data" : data })`. Data contains the object passed into `signalVisitor` by the agent. | | `onunique(uniqueid)` | Fires when the Presence Service has assigned a unique id to a connection established with `connectUnique()`. | --- ### Visitor Presence and Focus If a visitor has multiple windows or tabs open, only the currently active tab will send presence information or listen for messages from agents. ### Sample Code See [Sample Code](./sample) for details. ================================================================= FILE: /developer/presence/sample ================================================================= ## Visitor-Side Sample Code ```javascript // Instantiate a Visitor presence object var presencevisitor = new GLANCE.Presence.Visitor({ groupid: 123, // optional, defaults to GLANCE_COBROWSE.groupid visitorid: "111111111" // optional, defaults to GLANCE_COBROWSE.visitorid }); // Start sending regular presence updates (by default, every 60 seconds) presencevisitor.presence(); // Send a presence update (now) with some custom data presencevisitor.presence({ data: { wizardpage: 3 } }); // Listen for agent messages. presencevisitor.onsignal = function (msg) { console.log("Received", msg); }; presencevisitor.connect(); ``` --- ## Agent-Side Sample Code ```javascript // Authenticate the agent GLANCE.Authorization.authorize({ service: "presence", credentials: { username: "[Glance account username]", password: "[Glance account password]", gssnid: "[Glance website session id]", partnerid: "[Partner id, usually same as groupid]", partneruserid: "[Partner user id]", loginkey: "[Login key signed with secret api key]", g4scredentials: "[Glance for Salesforce credentials]" }, // Not all credentials fields are required. // See the page on Authorization Token for requirements. groupid: "1234", duration: "[duration of the authorization token in minutes 1-120]", onsuccess: showpresence, onfail: function(reason) { // display error ... console.error("Authorization failed:", reason); } }); // Define the global presence agent variable var presenceagent; function showpresence() { // Construct a new Presence Agent object presenceagent = new GLANCE.Presence.Agent({ visitorid: "111111111" }); // Setup event handlers presenceagent.onvisitorconn = function(e) { // visitor is connecting via websocket and can be signaled // display a "connected" status, e.g. light up a cobrowse button myhandlevisitor(); // Optional, lookup the visitor to find any associated data presenceagent.lookupVisitor({ onsuccess: function(visitordata) { myhandlevisitor(visitordata); }, onfail: function(reason) { console.error("Lookup failed:", reason); } }); }; } // Invoke a visitor side api. Put this code behind a "cobrowse" button. function invokeCobrowse() { presenceagent.invokeVisitor({ func: "GLANCE.Cobrowse.VisitorUI.showTerms", args: { sessionKey: "111111111" } }); } // Send a custom signal. onsignal will be called on the GLANCE.Presence.Visitor instance. // For example, put this code behind a "start chat" button. function startChatSignal() { presenceagent.signalVisitor({ chatid: "123456", command: "startchat" }); } ``` ================================================================= FILE: /developer/sdk/browseragent ================================================================= # Browser Agent SDK This SDK can be included by a Partner or Customer agent-side web application to: * Join a Glance screen share, Cobrowse, or 2-way mobile video session. * Lookup a session, or wait for a session to start. * Open a new window to connect to a session. * Receive lifecycle and error events from cobrowse and screenshare sessions including agent video. * Close the session viewer window. --- ## Partner Implementation **Step 1: Include the Glance JavaScript** The partner should include the script `https://storage.glancecdn.net/agent/js/GlanceAgent_6.55.0M.js` in their agent web application. **Step 2: Register for events** Register for events by calling `GLANCE.Agent.addEventListener` and/or `GLANCE.Agent.addEventListenerAll`. **Step 3: Authenticate the Agent** The customer application should call `GLANCE.Agent.authenticate` with a credentials object containing `partnerid`, `partneruserid`, and `loginkey`. These parameters are stored within the `GLANCE` namespace and used to authenticate the user for Glance web services. **Step 4: Join a session** Join a session by using one of the following methods: * `GLANCE.Agent.joinSession` * `GLANCE.Agent.openViewer`: This method can be used to avoid lookup requests if the session is known to be running. If SSO is not being used, `openViewer` can be called without calling `authenticate`, and the agent will simply be prompted to log in with their username and password. --- ### Example Implementations * **Using `joinSession`:** [https://storage.glancecdn.net/agent/samples/6_55_0/AgentTest.html](https://storage.glancecdn.net/agent/samples/6_55_0/AgentTest.html) * **Using `openViewer`:** [https://storage.glancecdn.net/agent/samples/6_55_0/AgentTest1.html](https://storage.glancecdn.net/agent/samples/6_55_0/AgentTest1.html) ================================================================= FILE: /developer/sdk/browseragent/reference ================================================================= # Browser Agent SDK Reference ### GLANCE.Agent.webserver The default value is `https://www.glance.net`. This should only be set if a different service address is being used. --- ### GLANCE.Agent.authenticate(credentials) Authentication is required for `joinSession` or `lookupSession`, optional for `openViewer`, and not used in `openAgentJoinURL`. Login key authentication call: ```javascript GLANCE.Agent.authenticate({ loginkey: "", partnerid: "", partneruserid: "" }); ``` See [Login Key Authentication](https://help.glance.cx/integrations/login-key/) for information on these parameters. --- ### GLANCE.Agent.joinSession(sessionkey[, joinparams]) * `sessionKey`: The key for the session the agent is attempting to join. * `joinparams`: Other optional parameters. Examples below: ```javascript const joinparams = { windowName: "Name of the window", // Window name for new window, defaults to "_blank" windowFeatures: "width=1000,height=1000", // Features for window.open, defaults to 800x800 window with no title or menu bar wait: true, // Boolean indicating whether the method should wait for a session to start, defaults to true agentVideo: "true", // Boolean. If true, the video will engage automatically as soon as the agent joins the session name: "Agnes Agent", // Stored on the agent's call viewer record email: "agnes@example.com", // Stored on the agent's call viewer record phone: "+17813162596", // Stored on the agent's call viewer record origin: "def6789", // Can be used to store the application used by the agent to join the session. xid: "abc12345", // An external ID for matching the session with the session record in another system used by the customer. // Note: Only the xid value supplied by the first agent is stored in the database. }; GLANCE.Agent.joinSession("5012", joinparams); // Joins a session with session key "5012" and the parameters listed above ```
Info
origin and xid may be up to 255 Latin-1 (ISO/IEC 8859-1) characters. For character type and length limits on name, email, and phone see this page.
This method will look up and join a Glance session, opening a new viewer window. This function returns a JavaScript [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). When the viewer window is opened, the Promise will "resolve" with a value that can be used to close the window with the `.close()` method. This is currently the actual Window object, but that may change in future releases. If opening the window is blocked by the browser popup blocker, the event `"popupblocked"` is fired. `joinSession` calls `GLANCE.Agent.lookupSession` passing `true` for the `wait` parameter. On `lookupFound`, this method calls `openAgentJoinURL` with the returned url. Various events are fired during the process. --- ### GLANCE.Agent.openViewer(sessionkey[, joinparams]) * `sessionKey`: The key for the session the agent is attempting to join. * `joinparams`: Other optional parameters. See `joinSession`. This method will open the agent viewer in a window to join a session. The function returns a JavaScript [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) like `joinSession`. If `authenticate` has been called with credentials, they will be used in `openViewer`. Otherwise, the agent will be prompted to login if they are not already.
Info
If you are using openViewer with an iframe id set (or using the joinSession method with iframe id set), make sure that your iframe implementation has the following attribute set: allow="camera *; microphone *"
--- ### GLANCE.Agent.openAgentJoinURL(agentjoinurl[, joinparams]) * `agentjoinurl`: URL to join the session, typically returned from `lookupSession`. * `joinparams`: Other optional parameters. See `joinSession`. This method will open the agent viewer URL in a window to join a session. This function returns a Javascript [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) like `joinSession`. This is intended to be passed the `agentjoinurl` returned from `lookupSession` or equivalent. --- ### GLANCE.Agent.lookupSession(sessionkey[, wait]) * `sessionKey`: The key for the session the agent is attempting to join. * `wait`: Optional boolean indicating whether the method should wait for a session to start. Defaults to true. ```javascript GLANCE.Agent.lookupSession("1234", false); // Attempts to look up session with key "1234". Will not wait. ``` This method looks up a session with the required session key parameter. Returns a Promise that resolves to an object. If the session is found, the Promise will resolve to an object that has the same properties as the `lookupFound` event, which also fires. Note the `agentjoinurl` property. Various errors, a timeout, or a canceled lookup will reject the Promise. A `lookupFailed` event will be fired for errors and timeouts. If `wait` is false, only one attempt is made to lookup. If the lookup request succeeds but the session is not found, the Promise resolves to `{}`. If `wait` is true (or omitted), the method repeatedly tries looking up the session for 45 seconds. Every time a new lookup is performed, a `lookupWaiting` event is fired. If the lookup times out, a `lookupFailed` event is fired with a reason property of `"timedout"`. The `lookupWaiting` event has data like `{ service: "agent", ssnkey: "1234", cancel: /* function */ }`. The property `cancel` is a function to call to cancel the lookup. This can be used if more than one lookup is in progress (not a typical use-case). --- ### GLANCE.Agent.cancelLookup() Stops the most recent lookup in progress, firing a `lookupCanceled` event. --- ### GLANCE.Agent.addEventListener(eventName, handler) * `eventName`: name of the event e.g., "sessionEnded". See below for the list of events. * `handler`: The function to be called. This method will set an event handler for the specified event. Where applicable, the handler is called with an `eventdata` parameter. ```javascript GLANCE.Agent.addEventListener("sessionEnded", function (eventdata) { // Perform your actions. }); ``` --- ### GLANCE.Agent.addEventListenerAll(handler) * `handler`: The function to be called This method will set an event handler for all events. The handler is called with two parameters: `eventname` and `eventdata`. For certain events, `eventdata` may be an empty object. ```javascript GLANCE.Agent.addEventListenerAll(function (eventname, eventdata) { // Perform your actions. }); ``` --- ### GLANCE.Agent.presenceConnect(visitorid) * `visitorid`: The id of the visitor to connect to via presence. `presenceConnect` establishes a connection to the Glance Presence Service for bidirectional communication with a similarly connected visitor. For communication to succeed, both the visitor and the agent must specify the same group id and visitor id. `GLANCE.Agent.authenticate()` must be called before invoking `presenceConnect()`. `presenceConnect()` returns a Promise which resolves when (and if) the visitor also connects to presence. The Promise rejects, and a `presenceFailed` event is fired, if `authenticate()` was not called or if the credentials have expired. To connect to a different visitor while already connected to Presence, first call `presenceDisconnect()`, then call `presenceConnect()` again with the new visitor ID. If `presenceConnect()` succeeds, the following events may be fired based on visitor activity: #### presence The `presence` event fires when the visitor transmits data. ```javascript { // the presence data sent by the visitor } ``` #### presenceAuthorized The `presenceAuthorized` event fires when the agent was able to authenticate using the credentials stored in `glanceCredentials`. ```javascript { "service": "Presence", "data": "payload_data" } ``` #### presenceError The `presenceError` fires when an error occurred during the presence connection. ```javascript { "error": "", "detail": "" } ``` *Error codes include:* * **authfailed** - Authorization token missing, bad, or expired. * **connfail** - Failed to establish or maintain the websocket connection. In the event of a connection failure, a "detail" property will include a detailed reason. * **connection** - Network connection dropped. * **error** - Server returned an error. * **invalidprotocol** - Visitor IDs contain special nats characters: space, *, and >. #### presenceFailed The `presenceFailed` event fires when an error occurred during the `presenceConnect()` flow and the connection failed. ```javascript { "service": "Presence", "reason": "" } ``` *Error codes include:* * **No credentials** - when credentials have not been provided in the `glancecredentials` object. * **error** - When the call to the authorization service was not successful, or another exception occurred during the `presenceConnect()` flow. #### presenceVisitorError The `presenceVisitorError` event fires when a "visitorerror" message is received on the presence connection, indicating that the visitor encountered an error while attempting to start a Cobrowse session. ```javascript { "code": "", "msg": "" } ``` #### presenceOnTerms The `presenceOnTerms` event fires when the terms and conditions dialog is displayed, accepted, or declined by the visitor. ```javascript { "status": "displayed" // or "accepted", "declined" } ``` #### presenceSessionEnd The `presenceSessionEnd` event fires when the visitor ends the session. ```javascript {} ``` #### presenceSessionStart The `presenceSessionStart` event fires when the visitor invokes the start session. When the agent clicks Join in a presence state (orange button), an accept modal is displayed to the visitor. When they click accept, the session is invoked. ```javascript {} ``` #### presenceVisibility The `presenceVisibility` event fires when the visitor's browser tab visibility changes. ```javascript { "visibility": "visible" // or "hidden" } ``` #### visitorData The `visitorData` event fires when the visitor successfully connects ("onvisitorconn"). ```javascript { "connected": true // or false } ``` --- ### GLANCE.Agent.presenceDisconnect() Disconnects the agent from the presence service. Once disconnected, the agent will no longer receive any events related to activity on the visitor side. Calling `GLANCE.Agent.presenceStartSession` will immediately reject the promise and fire `presenceInvokeFailed` with the following payload: ```javascript { "service": "presence", "reason": "notconnected" } ``` `GLANCE.Agent.presenceConnect(visitorid)` may be called again for the same visitor or a different visitor without having to authenticate again. **Returns:** `undefined` --- ### GLANCE.Agent.presenceSignalVisitor(params) *Note: `Glance.Agent.presenceSignalVisitor` requires version 7.3 script package and must have `presenceConnect()` called first.* Signals the specified visitor, passing a JSON message. There must be a connected `GLANCE.Presence.Visitor` instance on the visitor side to receive the signal. Params should include the following properties: ```javascript { "data": {} // The data to be sent in the signal } ``` If signaling fails, a `presenceSignalFailed` event is fired with payload: ```javascript { "service": "presence", "reason": "" } ``` **Returns:** `undefined` --- ### GLANCE.Agent.presenceStartSession(visitorid[, invokeparams, joinparams]) *Note: `GLANCE.Agent.presenceStartSession` must have `presenceConnect()` called first.* * `visitorid`: The id of the visitor. Used as the `sessionkey` by default. * `invokeparams`: Invokes a visitor side JavaScript function. * `joinparams`: Optional parameters passed to `joinSession`. See above. This method returns a promise that resolves to `GLANCE.Agent.joinSession`(see above) with the `visitorid` as the `sessionkey` (or as a random integer if left undefined) and `joinparams` provided. It must be called after `presenceConnect` for the given `visitorid`. The presenceAgent invokeVisitor function is called with the `invokeparams` argument or as default the `GLANCE.Cobrowse.VisitorUI.showTerms` if left undefined. ```javascript const invokeparams = { func: "GLANCE.Cobrowse.VisitorUI.showTerms", // The function that will be invoked on the visitor side. args: { groupid: "20541", // The group that the session will start in. The value passed here must match one of the group ids included in the script tag on the visitor side. video: "off", // The state of video when the session starts on the visitor side. Other options are "large" and "small". Overrides the group default and script tag setting. }, }; ``` If `invokeVisitor` fails, the promise is rejected and an event is fired: #### presenceInvokeFailed The `presenceInvokeFailed` event fires when the `GLANCE.Presence.invokeVisitor` method fails and the `onfail` function is called. ```javascript { "service": "Presence", "reason": "" } ``` --- ### GLANCE.Agent.inSession(sessionkey) This method returns a promise. `sessionkey` is a required parameter. * If the session key matches an active session that the agent is currently participating in, the promise resolves to a boolean `true`. Otherwise, resolves to `false`.
Warning
Calling insession() without parameters is possible but is not supported. Currently, this will return an array of sessions that the agent is participating in, but this functionality should not be relied on and will be separated into a different method in a future release.
--- ## Agent Events These are events generated by the Browser Agent API itself. There are a set of named events for each service. The event data will often have an attribute "service" that will be one of "agent", "screenshare", "cobrowse", or "video". Other attribute values may change in future releases. Certain events require communication from the Glance Agent Viewer window to the page hosting the Browser Agent API. Depending on the domains in use, additional configuration may be required. [Contact Glance](https://help.glance.cx/account-management/contact/) to complete this setup. #### connected The `connected` event fires when the agent joins a Cobrowse or Screenshare session. ```javascript { "ssnkey": "", "groupid": "", "service": "" } ``` #### iframeblocked The `iframeblocked` event fires when an iframe is blocked on the agent's side. ```javascript { "service": "agent" } ``` #### inSession The `inSession` event fires when the `GLANCE.Agent.inSession` method is called. ```javascript { "service": "agent", "ssnkey": "" } ``` *"Sessionkey" in this event is the session key passed into the inSession method.* #### lookupWaiting The `lookupWaiting` event fires during a `lookupSession` function when event data is being looked up in the database. ```javascript { "service": "agent", "ssnkey": "", "cancel": "[Function: cancel]" } ``` #### lookupFailed The `lookupFailed` event fires during a `lookupSession` function when an error occurs. Fail scenarios include: * The API returned an error * An exception occurred in the client code * The lookup exceeded the retry number (The lookup searches immediately, then retries every 3 seconds for the first 15 seconds, then every 5 seconds for the next 30 seconds) ```javascript { "service": "agent", "ssnkey": "", "reason": "" } ``` #### lookupCancelled The `lookupCancelled` event fires during a `lookupSession` function when a lookup event was cancelled. ```javascript { "service": "agent", "ssnkey": "" } ``` #### lookupFound The `lookupFound` event fires during a `lookupSession` function when a lookup event was successful. ```javascript { "service": "agent", "id": "", "ssnid": "", "serverip": "", "servername": "", "personid": "", "groupid": "", "passcode": "", "agentjoinurl": "", "clientjoinurl": "", "visitorversion": "" } ``` #### popupblocked The `popupblocked` event fires when a pop up has been blocked (i.e., The Agent Join modal). ```javascript { "service": "agent" } ``` #### sessionEnded The `sessionEnded` event fires when a Cobrowse or Screenshare session ends. ```javascript { "ssnid": "", "ssnkey": "", "groupid": "", "reason": "", "service": "" } ``` #### viewerClosed The `viewerClosed` event fires when the agent viewer window has closed. ```javascript { "service": "agent" } ``` #### visitorConnected The `visitorConnected` event fires when the visitor connects or disconnects from the presence service. This information can be used to display a status indicator to the agent (e.g., Turning the JOIN button in a CRM from blue to orange). ```javascript { "connected": true // or false } ``` #### viewerOpened The `viewerOpened` event fires when the agent viewer window has opened. ```javascript { "service": "agent", "close": "[Function: close]" } ``` --- ## Cobrowse Events Includes the events documented in the Cobrowse Agent API. #### connecting The `connecting` event fires when the agentview page is loaded. ```javascript { "groupid": "72", "visitorid": "00000", "ssnkey": "00000", "service": "cobrowse" } ``` #### navigate The `Maps` event fires when a visitor navigates to a new page using a link, the browser's back/forward/refresh buttons, or when the visitor's tab regains focus. The object passed to the event handler includes information about the browser and URL. ```javascript { "browser": { "name": "chrome", "platform": "win", "version": 80 }, "visitorversion": "4.9.2.0", "url": "[https://ew10.myglance.org/test/CobrowseTest2.htm](https://ew10.myglance.org/test/CobrowseTest2.htm)", "pagemasked": "false", "service": "cobrowse" } ``` #### agents The `agents` event announces agents joining or leaving the session. ```javascript { "count": 1, "agentlist": [], "service": "cobrowse" } ``` #### rc The `rc` event fires when the remote control state changes. The `enabled` property of the object indicates whether remote control is currently enabled. The `suspended` property indicates whether control is temporarily suspended due to visitor mouse or keyboard activity. ```javascript { "enabled": false, "suspended": true, "service": "cobrowse" } ``` --- ## Screenshare Events #### connecting The `connecting` event fires when the agent viewer page is connecting to the screenshare session. The event data has various parameters; the most interesting is probably `"visitorversion"` which contains the Glance version number on the visitor side, plus OS type and version. Also contains `"agentusername"`, the Glance Address of the agent. ```javascript { "calltype": "G", "ssnkey": "4400", "ssnid": "20541.4400.846930886", "agentconnect": true, "server": "", "maincid": 88071823, "displayprotocolversion": 1019, "callflags": 2195648, "visitorversion": "4.17.1.18+GCD+OS%3d%22Mac+OS+X+10.16+(20D91)%22", "agentusername": "joe.demo.glance.net", "agentinfo": { "username": "joe.demo.glance.net", "partnerid": 20541, "partneruserid": "Demo", "name": "Joe Demo", "title": "" }, "videoserver": "video.glance.net", "agentvideo": 0, "service": "screenshare" } ``` #### screen The `screen` event fires when a session starts and whenever display size changes. ```javascript { "display": { "width": 375, "height": 812 }, "view": { "width": 211, "height": 458 } } ``` #### stats The `stats` event shows statistics on screenshare bandwidth and frame rate (values can be null). ```javascript { "bytespersec": 5221.8, "framespersec": 0.4 } ``` #### conndrop The `conndrop` event fires when a connection either drops or fails to open. ```javascript {} ``` --- ## Video Events #### initialized The `initialized` event fires after the initialization of the Glance video (web-screenshare) environment. ```javascript { "service": "video" } ``` #### previewStarted The `previewStarted` event fires after the "initialized" event when the preview started, indicating that the "startPaused" parameter mentioned in "initialized" was false. Used with cobrowse sessions, not used within screenshare sessions. ```javascript { "service": "video" } ``` #### videoStarted The `videoStarted` event fires when the actual video session starts (when video is streamed to the video server). ```javascript { "options": { "sessionkey": "1498V231480", "bgBlur": true, "maincallid": "86490035", "vserver": "[https://video.glance.net/](https://video.glance.net/)", "width": 352, "height": 288, "framerate": 15, "bandwidth": "250kbps", "mime": null, "modelID": "browser", "deviceName": null, "maincid": null, "stopPreviewsOnSessionEnd": true, "groupid": null, "partnerid": null, "username": null, "isAnonymous": null, "password": null, "videoBackEnabled": false, "bitspersecond": 250000, "requestedbitspersecond": 250000, "device": "LG UltraFine Display Camera", "sourceDevice": "LG UltraFine Display Camera (043e:9a4d)" }, "service": "video" } ``` #### videoEnded The `videoEnded` event fires when the video session ends. ```javascript { "service": "video" } ``` #### visitorvideo The `visitorvideo` fires when the visitor's video state changes, either by pause/unpause or by resizing small/large. ```javascript { "video": "small", "paused": false, "service": "cobrowse" } ``` #### guestCountChanged This event with `"count": 1` means the visitor side has connected to the video session. `0` means the visitor has disconnected. ```javascript { "count": 1, "service": "video" } ``` #### error The `error` event fires when an error happened to the video service (e.g., camera is occupied by another app, browser doesn't support video or screenshare, cancel button clicked on get display media dialog, etc.) ```javascript { "message": "initialize failure", "options": { "sessionkey": "1234V823366", "maincallid": "13685174", "vserver": "[https://video.myglance.org/](https://video.myglance.org/)", "width": 176, "height": 144, "framerate": 15, "bandwidth": "250kbps", "mime": null, "modelID": "browser", "deviceName": null, "maincid": null, "stopPreviewsOnSessionEnd": true, "groupid": null, "partnerid": null, "username": null, "isAnonymous": null, "password": null, "bitspersecond": 250000, "requestedbitspersecond": 250000, "device": "cam1", "sourceDevice": "Logitech HD Webcam C615 (046d:082c)" }, "service": "video" } ``` #### notEnabled The `notEnabled` event fires when the agent's browser does not support video. ```javascript { "reason": "AgentVideo script not loaded (unsupported browser or visitor script version?)", "service": "video" } ``` #### info These are informational messages from either the client itself or from the video server. ```javascript { "message": "", "options": { "bandwidth": "1500kbps", "bgBlur": true, "bitspersecond": 1500000, "device": "Logitech HD Webcam C615", "deviceName": undefined, "framerate": "15", "groupid": null, "height": 288, "isAnonymous": false, "maincallid": null, "maincid": null, "mime": "video/webm; codecs=\"avc1.42E01E\"", "modelID": "browser", "partnerid": null, "password": null, "requestedbitspersecond": 1500000, "sessionkey": "tjtaAg", "sourceDevice": "Logitech HD Webcam C615 (046d:082c)", "stopPreviewsOnSessionEnd": false, "username": null, "videoBackEnabled": false, "server": "[https://myvideo.myglance.org:3000/](https://myvideo.myglance.org:3000/)", "width": 352 } } ``` Among these sent by the client are: * `'Background Blurring requires a more powerful version of WebGL than is supported by your browser.'` Notice that though background blurring has been requested, it has been disabled because though the client browser supports WebGL, it is not a powerful enough implementation to support Agent detection and background blurring. * `'Background Blurring requires WebGL which is not supported by your browser.'` Notice that though background blurring has been requested, it has been disabled because the client browser does not support WebGL which is required for background blurring. ================================================================= FILE: /developer/sdk/guest_join_sdk ================================================================= # Guest Join SDK Cobrowse includes the ability for agents to optionally admit unauthenticated "guests" into sessions as additional participants to view the visitor's browser. Glance supplies a default guest join experience for each group. To see what this looks like, navigate to the following URL, substituting your group ID for the parameter at the end: `https://www.glance.net/guest/?groupid=[groupid]` In addition to the out-of-the-box flow, Glance also offers the Guest Join SDK, which allows you to customize the experience. If you choose this option, you must supply the UI entirely. Complete the following steps to implement the Guest Join SDK: ### 1. Download or Reference the SDK File The Guest Join SDK can be utilized by linking to the following URL: * Staging = `glance.net/script/[groupid]/staging/Guest` * Production = `glance.net/script/[groupid]/production/Guest`
Note
The [groupid] in the above URLs must be replaced with your Group ID.
Below is an example script source tag that could be added your Guest Join page: {% tabs %} {% tab title="Production" %} ```html ``` {% /tab %} {% tab title="Staging" %} ```html ``` {% /tab %} {% /tabs %} *Note: In the example above, 12345 is used as a Group ID, you would need to update this value with your Group ID.* --- ### 2. Construct the UI At a basic level, the act of admitting a guest to a Cobrowse session involves: 1. Connecting to the Glance service from the guest's device. 2. Receiving a code from the Glance service (i.e., the *guestcode*). 3. Communicating the *guestcode* to the agent so the agent can use it to admit the guest. Generally, the above flow is accomplished via a web interface made available to the guest, which involves building: 1. A webpage where the guest can optionally enter their name and click a button to generate a 6-digit code (the *guestcode*). 2. A page that displays the *guestcode* once generated. 3. Some error handling/messaging. For example, you could build a page similar to the default guest join experience that looks like this: Default Guest Join UI Example It contains one form field and one button. When the guest clicks **Continue**, your page will run code similar to the following, leveraging the Glance SDK in various places: ```javascript async function getJoinCode() { // define the guest's name, or use the generic "Guest" if the field is blank var guestName = document.querySelector("#GuestName").value ? document.querySelector("#GuestName").value : "Guest"; // Show or hide UI as appropriate, for example: $("#headermessagetext").hide(); $("#guestname").hide(); $("#waitingtext").show(); $("#joincode").show(); let connector = new GLANCE.Guest.Connector({ groupid: groupid, // Make sure to replace with your unique group id ws: "www.glance.net", }); connector.addEventListener("timeout", () => { // Perform functions/adjust UI in the event that the agent fails to admit the guest before the code times out }); connector.addEventListener("error", () => { // Perform functions/adjust UI in the event of an error }); let guestcode = await connector.connect(guestName); if (!guestcode.ok) { // Perform functions/adjust UI in the event of an error } else { // guestcode.code contains the code to be displayed to the user. Adjust the UI and display it to the user. // guestcode.timeout indicates the number of seconds until the code will timeout. // You may optionally use this to extend the timeout, possibly in response to a user prompt if desired. } } ```
Info
The code example above is for illustrative purposes only. It will need to be adjusted based on the exact design of your page and cannot be used as is.
The resulting page could look something like this: Custom Guest Join UI Example When the agent admits the guest successfully, the guest's browser will automatically be redirected to the **Guest Viewer** page (hosted on glance.net) so this event does not need to be handled explicitly. After the session, the guest is redirected to a URL that can be specified in the **Account Management** area of glance.net. Refer to the [Glance Guest API Reference Document](https://glance.gitlab.io/glance-client-src/GLANCE.Guest.html) for a breakdown of the events, parameters, and additional functionality available. ================================================================= FILE: /developer/sdk ================================================================= The Glance SDK suite provides developers with the tools needed to embed seamless, real-time collaboration directly into any platform. Whether you are building a custom agent desktop, integrating into a native mobile app, or creating a frictionless join experience for your customers, our SDKs offer flexible, out-of-the-box components and granular API controls. Choose the SDK that fits your implementation: {% launcher %} {% card title="Browser Agent SDK" description="Embed the Glance Agent experience directly into your web-based CRM, CCaaS, or custom support portal." href="/sdk/browser-agent/" icon="🌐" /%} {% card title="Mobile SDK" description="Integrate cobrowse, screen sharing, and masking natively into your iOS and Android applications." href="/sdk/mobile/" icon="📱" /%} {% card title="Guest Join SDK" description="Create frictionless, one-click session join experiences for your customers directly in the browser." href="/sdk/guest-join/" icon="🤝" /%} {% /launcher %} ## Choosing the Right SDK * **Building for the Agent:** If you are a developer tasked with integrating the Glance agent viewer into tools like Salesforce, Zendesk, Genesys, or your own proprietary web dashboard, you will want the **Browser Agent SDK**. * **Building for the App User:** If you need to allow customers to share their mobile app screen with your support team, use the **Mobile SDK** (available for iOS and Android). * **Building for the Web User:** If you want to dynamically launch sessions for customers visiting your website without requiring them to download anything, the **Guest Join SDK** is your go-to. ================================================================= FILE: /developer/sdk/mobile_sdk/flows ================================================================= The following flowcharts illustrate Glance's operations when using the mobile SDK. ## Initialize Glance and Join a Session Flowchart showing the initialization of Glance and joining a session ## Presence Connect Flow from Mobile SDK Host App to Custom Tab in Web Browser Flowchart showing the Presence connect flow from the Mobile SDK Host App to a Custom Tab in the Web Browser ================================================================= FILE: /developer/sdk/mobile_sdk ================================================================= The mobile SDK is easy to integrate into your mobile apps and pairs with pre-built integrations to agent desktops of CRM, CCaaS, and custom systems to offer a complete, out-of-the-box solution. ## iOS Get started integrating Glance into your iOS Apps with Swift or Objective-C. * **[iOS SDK](https://gitlab.com/glance-sdk-public/glance-sdk-ios-releases):** Provides essential core features, enabling our customers to implement event handling without a UI. * **[iOS Default UI SDK](https://gitlab.com/glance-sdk-public/glance-default-ui-ios-releases):** An out-of-the-box implementation of our iOS SDK with a default UI and sample app that can be copied and customized to fit a company's brand. ## Android Get started integrating Glance into your Android Apps with Kotlin or Java. * **[Android SDK](https://gitlab.com/glance-sdk-public/glance-sdk-android-releases):** Provides essential core features, enabling our customers to implement event handling without a UI. * **[Android Default UI SDK](https://gitlab.com/glance-sdk-public/glance-default-ui-android-releases):** An out-of-the-box implementation of our Android SDK with a default UI and sample app that can be copied and customized to fit a company's brand. ================================================================= FILE: /developer/sdk/mobile_sdk/masking_android ================================================================= In **Glance Mobile Cobrowse**, masking is a critical feature used to protect sensitive or private information on the end user�s screen during a live session with an agent. By selectively hiding specific UI elements�such as passwords, credit card fields, or health data�from the representative's view, masking allows companies to safeguard sensitive information while still providing real-time support. To enable masking during sessions, developers should use the Glance Mobile SDK to designate which portions of the screen should be hidden from agents. Masking integrates with the native rendering layer of the mobile app, allowing developers to selectively hide sensitive views. There are four main contexts in which masking can be applied: * **View Masking (Traditional Android Views)** * **Jetpack Compose Masking** * **WebView Masking** * **Keyboard Masking** Below are best practices for each of these contexts, as well as general masking guidelines that apply in all situations. --- ## General Masking In all contexts, once an element is designated to be masked by the SDK, it will remain obscured from the agent's view for the duration of all current and future sessions. Given this behavior, masking should be applied at the time views are created�during layout or initialization�rather than waiting until a session has begun. This ensures that masking is consistently applied, even if a session starts after the views are already rendered or if views are recreated during the app lifecycle. Similarly, when a view is destroyed, masking should be removed. In most cases, masking is automatically removed when the view is destroyed, but best practice is to explicitly remove it in the view's destructor. Masking is always applied if the view is visible. If a view is destroyed and no longer present, masking will be removed and will not appear during sessions. There are, however, situations in which a mask might be applied even though the view is not visible�primarily when the view is covered by another view, which the SDK may not detect. In such cases, if masking is not desired, it should be removed and reapplied when the view becomes visible again. ### Takeaways * Masked elements remain hidden for the entire session once registered with the SDK. * Apply masking during view initialization or layout, not after a session begins. * Always remove masking when a view is destroyed or removed and no longer used. --- ## View Masking For apps built using traditional Android Views, masking is performed by passing view IDs or view references to the SDK. Masking can be removed by making calls to remove masked views using references to the masked views. Below are the methods that should be used for masking Android views: ```java // Adding Masked Views by ID Glance.addMaskedViewId(R.id.sensitiveTextField, "Masked text field"); Glance.addMaskedViewId(R.id.sensitiveLabel, "Masked label"); Glance.addMaskedViewId(R.id.sensitiveButton, "Masked button"); // Adding Masked Views by reference Glance.addMaskedView(textField, "Masked text field"); Glance.addMaskedView(label, "Masked label"); Glance.addMaskedView(button, "Masked button"); // Removing Masked Views Glance.removeMaskedViewId(R.id.sensitiveTextField); Glance.removeMaskedView(textField); ``` When using traditional Android Views, the SDK utilizes the view�s visibility to determine when masks should be displayed. In these cases, you typically do not need to manually add or remove masked views based on visibility. However, there are scenarios where masks might remain visible even when the corresponding views are obstructed�for example, when covered by a `Dialog` or a `Compose` view rendered in a way that prevents the SDK from detecting the obstruction. In such cases, you may need to explicitly call `removeMaskedView` when the view is no longer visible and reapply it using `addMaskedView` once it becomes visible again.
Note
This is a rare situation. In most cases, manual intervention is not required.
--- ## Jetpack Compose Masking Since Jetpack Compose does not expose elements via referenceable IDs and manages its UI through an internal layer, masking is applied using modifiers. Because of this internal architecture, the SDK has limited ability to detect whether a Compose view is obstructed by other UI elements. As a result, masking will remain active for any Compose element that is present on the screen, even if it's visually covered by another element. In these cases, the app is responsible for managing the view's visibility and conditionally applying the masking modifier only when the view is actually visible. Below is an example that illustrates how to conditionally apply a masking modifier to a Compose view: ```kotlin @Composable fun MaskedPasswordField() { var isVisible by remember { mutableStateOf(true) } if (isVisible) { OutlinedTextField( value = "", onValueChange = {}, label = { Text("Enter Password") }, modifier = Modifier.glanceMask("Password Field") ) } else { OutlinedTextField( value = "", onValueChange = {}, label = { Text("Enter Password") } ) } } ``` Jetpack Compose re-renders UI elements in response to state changes, so unnecessary or frequent updates to state values can lead to excessive recompositions and performance overhead. For optimal performance, only update state variables when the visibility or content of a view meaningfully changes, rather than on every minor event or frame. Efficient and minimal recomposition is essential to maintaining performance in Jetpack Compose applications. --- ## WebView Masking Masking in a WebView is applied using CSS selectors or element IDs. The mask will be displayed as long as the WebView is visible and present in the view hierarchy. Setting the WebView�s visibility to `GONE` will also hide its masks. However, removing the WebView from the view hierarchy does not automatically remove masking. WebView masking differs slightly from native view masking. It requires that you explicitly remove the `GlanceWebViewJavascriptInterface` when masking is no longer needed. While the operating system typically cleans up a WebView and its associated JavaScript interface when it is no longer in use, there are cases where the OS may retain a WebView for performance reasons. To ensure proper cleanup, it�s best practice to manually remove masking from the WebView when it's no longer required. Applying WebView masking: ```java String queryMaskSelectors = ".mask_1, .mask_2, #mask_3, .mask_4, #hplogo"; String labelsToMask = "mask 1, mask 2, mask 3, mask 4, LOGO"; WebView webView = new WebView(context); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); GlanceWebViewJavascriptInterface jsInterface = new GlanceWebViewJavascriptInterface(webView); webView.addJavascriptInterface(jsInterface, "GLANCE_Mask"); GlanceWebViewClient webViewClient = new GlanceWebViewClient(queryMaskSelectors, labelsToMask); webView.setWebViewClient(webViewClient); ``` Cleanup when done: ```java webView.removeJavascriptInterface("GLANCE_Mask"); jsInterface.onDestroy(); ``` --- ## Keyboard Masking (Optional) If your app includes custom keyboards or input accessory views that display sensitive content, you should apply the same masking techniques used for regular Android views. This can be done using either `addMaskedView` for traditional views or the `glanceMask` modifier for Jetpack Compose, depending on your implementation. For standard system keyboards, masking can be applied using the following method: ```java Glance.maskKeyboard(true); ``` This can be set during session initialization: ```java DefaultSessionUI.init( activity, startParams, true, // maskKeyboard parameter groupId, visitorId, eventsListener ); ``` ================================================================= FILE: /developer/sdk/mobile_sdk/masking_ios ================================================================= # iOS Masking Best Practices In Glance Mobile Cobrowse, masking is a critical feature used to protect sensitive or private information on the end user�s screen during a live session with an agent. By selectively hiding specific UI elements�such as passwords, credit card fields, or health data�from the representative�s view, masking enables companies to safeguard user privacy while still delivering real-time support. To enable masking during sessions, developers should use the Glance Mobile SDK to specify which parts of the screen should be hidden from agents. Masking integrates directly with the app's native rendering layer, allowing developers to selectively obscure sensitive views. There are four primary contexts in which masking can be applied: * **UIKit Masking** * **SwiftUI Masking** * **WebView Masking** * **Keyboard Masking** Below are best practices for each of these contexts, along with general masking guidelines that apply in all situations. --- ## General Masking In all contexts, once an element is designated to be masked by the SDK, it remains hidden from the agent�s view for the duration of the current session and any future sessions unless explicitly removed. Because of this behavior, masking should be applied during the creation of views�either at layout or during initialization�rather than waiting until a session begins. This ensures that masking is consistently applied, even if a session starts after views have already been rendered, or if views are recreated during the app lifecycle. Similarly, masking should be removed when a view is destroyed or removed from the view hierarchy. In most cases, masking is automatically removed when the associated view is deallocated. However, best practice is to explicitly remove the mask in the view�s destructor or lifecycle cleanup logic. Masking will always be active when the view is being displayed. If a view is destroyed or no longer present in the hierarchy, the mask will be removed and will not appear during sessions. However, there are cases where a mask may appear even though the view is not visibly present�typically because it is being covered by another view. Since the SDK cannot always detect when a view is visually obstructed, developers should manually remove and reapply masking when visibility changes and masking is not desired. ### Takeaways * Masked elements remain hidden for the entire session once registered with the SDK. * Apply masking during view initialization or layout, not after a session begins. * Always remove masking when a view is destroyed or removed from the hierarchy. --- ## UIKit Masking For apps built using UIKit (iOS), masking is applied by passing references to views directly to the SDK. Masking can be removed by calling the appropriate SDK methods and providing references to the views to be unmasked. Below are the Swift methods that should be used for masking UIKit-based views: ```swift // Adding Masked Views Glance.addMaskedView(textField, withLabel: "Masked text field") Glance.addMaskedView(label, withLabel: "Masked label") Glance.addMaskedView(button, withLabel: "Masked button") // Removing Masked Views Glance.removeMaskedView(textField) Glance.removeMaskedView(label) Glance.removeMaskedView(button) ``` When using UIKit, the SDK relies on the native view hierarchy to determine which views should be masked. Typically, you do not need to manually add or remove masked views based on their visibility�this is handled automatically. However, in certain edge cases, masks may remain visible even when the corresponding views are actually obstructed by another view. This situation can occur with elements like `UIAlertView` or with SwiftUI views layered on top of UIKit views in a way that prevents the SDK from detecting the obstruction. In such cases, you may need to explicitly call `removeMaskedView` when the view is no longer visible, and `addMaskedView` when it becomes visible again.
Note
This is a rare situation. In most cases, manual intervention is not required.
--- ## SwiftUI Masking Since SwiftUI manages its UI through a separate rendering layer and does not expose elements directly in the native view hierarchy, masking is applied using modifiers. Due to the limited access the SDK has to SwiftUI's internal structure, it cannot always detect when SwiftUI views are obscured by other elements. As a result, masks will remain active for any SwiftUI element that is part of the visible SwiftUI hierarchy, regardless of whether it is visually covered. To address this, the app must manage view visibility explicitly and apply the masking modifier conditionally�only when the view is actually visible. Note: SwiftUI automatically re-renders views whenever any of their bound state variables change. Avoid excessive or unnecessary state updates, as they can lead to redundant view redraws and performance degradation. However, this reactive behavior can be leveraged for masking: by using a state variable to track a view�s visibility and toggling that state, you can effectively add or remove the masking modifier when appropriate. Below is an example that demonstrates how to conditionally apply a masking modifier to a SwiftUI view: ```swift struct MaskedPasswordField: View { @State private var isVisible = true var body: some View { if isVisible { TextField("Enter Password", text: .constant("")) .addMaskedView(label: "Password Field") } else { TextField("Enter Password", text: .constant("")) } } } ``` --- ## WebView Masking Masking at the WebView level can be applied using **CSS selectors** and **element IDs**, allowing the SDK to hide specific content within the WebView. Similar to SwiftUI, WebView masking is visible as long as the WebView itself is visible and part of the view hierarchy. Setting the WebView's `isHidden` property to `true` will also hide its masks. However, removing the WebView from the view hierarchy does not automatically remove the masks. WebView masking differs slightly from native view masking in that it requires explicit removal of the masking controller. When you are done masking content within a WebView, you must manually remove the `GlanceWebMaskingController`. While in most cases the operating system will clean up the WebView and its associated `glanceMaskContentController` when it is no longer needed, there are instances where the OS may retain the WebView for performance reasons. Because of this, it is best practice to explicitly release the masking controller when the WebView is no longer in use. Even if the WebView has been removed from the screen, if it has not been fully deallocated, you should ensure that the `glanceMaskController` calls its `onDestroy()` method. Below is the code example for properly cleaning up WebView masking: ```swift let maskingQuerySelectors = [".mask_1", ".mask_2", "#mask_3", ".mask_4", "#hplogo"] let maskingLabels = ["mask 1", "mask 2", "mask 3", "mask 4", "LOGO"] glanceMaskContentController = GlanceMaskContentController( maskingQuerySelectors.joined(separator: ", "), labels: maskingLabels.joined(separator: ", ") ) let config = WKWebViewConfiguration() config.userContentController = glanceMaskContentController maskingWebView = WKWebView(frame: self.view.bounds, configuration: config) maskingWebView.load(URLRequest(url: URL(string: url)!)) glanceMaskContentController.setWebView(maskingWebView) self.view.addSubview(maskingWebView) ``` Cleanup when done: ```swift glanceMaskContentController.onDestroy() ``` --- ## Keyboard Masking (Optional) If your app includes custom keyboards or input accessory views that display sensitive content, you should apply the same masking techniques used for regular UIKit or SwiftUI views. Depending on the implementation, use either `addMaskedView` for UIKit components or the `.addMaskedView()` modifier for SwiftUI. For standard system keyboards, masking can also be applied using the following method: ```swift Glance.maskKeyboard(true) ``` ================================================================= FILE: /index =================================================================

Glance Docs

Get the most out of Glance. Access comprehensive guides, API documentation, and configuration best practices to seamlessly integrate Glance into your customer engagement strategy.

Integration guides and SDKs for bringing Glance into your web, mobile, and desktop applications.

Direct access to our REST APIs for managing users, sessions, reporting data, and webhooks.

Admin configuration, security & compliance protocols, and user guides for managing your Glance account.

Stay up to date with the latest features, improvements, and fixes across the Glance platform.

================================================================= FILE: /release-notes ================================================================= # Release Notes {% callout type="check" title="check" %} These are release notes. {% /callout %} ================================================================= FILE: /users/Integrations ================================================================= # Integrations You can integrate Glance with any system, CRM, CCaaS, or custom workplace solution used to interact with customers. You can set up an integration to detect if customers are logged into their online account to instantly connect a Glance session without needing a session code or any additional steps. You can also proactively start Cobrowsing sessions when conditions are right by leveraging business intelligence, routing rules, AI signals, or customer preferences. Each Glance session can be automatically logged as an activity in the integrated system to report out on key performance indicators and usage metrics. ## User-facing Integrations You have several choices for integrating Glance seamlessly with your user-facing systems. You can: * Configure Glance to integrate with: * Salesforce * Genesys * Amazon Connect * Five9 * Twilio Flex * Microsoft Dynamics * Configure our products for seamless integration with your organization's IT infrastructure. To achieve this, you may utilize the following options: * Service Target URLs (STUs) - hyperlinks to give your users quick access to Glance. * Login Keys - a way to use an API key to authorize your users. ## Single Sign-On You can set up single sign-on to Glance for your users. Glance works as a SAML Service Provider (also known as a Federation Services Relying Party when integrating with Microsoft Windows Active Directory). Glance offers two embed options for Identity Provider login: you can either embed the login page directly, or open it in a pop-up window to handle the initial login. Glance Customer Success will work with you to configure the option that works best for you. ## User Account Provisioning To manage your Glance user accounts you can integrate Glance's APIs into your back-end systems. You can provision (i.e., create and delete Glance accounts) for your users. To do this: * Use our user provisioning API. * Use the autoprovisioning capability (also known as just-in-time provisioning) of Glance's SAML Service Provider implementation. ## Data and Analytics The Customer Records Retriever (CRR) is a public-facing HTTP interface for Glance customers to retrieve data related to their product activity. Refer to this page for detailed information. ================================================================= FILE: /users/Integrations/salesforce ================================================================= This is Salesforce ================================================================= FILE: /users/Integrations/salesforce/sf_visitor =================================================================
Note
To see visitor information, you must use version 3.42 or later of the Glance for Salesforce Package. This feature is only available during 1-Click Connect for Cobrowse or Mobile SDK sessions.
When using 1-Click Connect, agents can preview the visitor's device, browser, and current URL before joining the session. This allows agents to understand the visitor's environment immediately. *Note: Available details may vary depending on the visitor's device.* 1. Navigate to the **Glance Company Settings** page within Salesforce. 2. Scroll down to the **Presence Settings** section. 3. Select **Show Visitor Information** to enable this feature. Visitor Information Settings 4. When a visitor is detected on the current Salesforce Object, the **Glance Component** displays the following information: * **Type:** Desktop Web, Mobile Web, or Mobile App (SDK). * **URL:** The URL of the page the visitor is browsing; you can hover over the URL to view the entire path. * **Browser:** The browser the visitor is using and its version. * **OS:** The Operating System for the visitor. Visitor Information Component ================================================================= FILE: /users/Integrations/service-target-urls ================================================================= ## What is a Service Target URL? A *Service Target URL* (STU) is a hyperlink that links directly to a specific Glance service or task. For example, when a Glance user visits an Agent Join STU, they immediately see the page where they can enter a session code provided by a customer to join a session. (If the user is not yet logged in to Glance, they are prompted to log in first). Agent Join Screen The base URL for the Agent Join page is: ```text https://www.glance.net/agentjoin/agentjoin.aspx ``` When setting up Glance for your users, you can embed STUs in their web portal or application. For example, to produce a "Join Session" link, add this HTML code: ```html Join a Glance Session ``` --- ## STUs without Single Sign-On These URLs are for standard accounts that do not use SAML SSO. * `https://www.glance.net/agentjoin/AgentJoin.aspx` – Prompts the agent for a session key. * `https://www.glance.net/agentjoin/AgentView.aspx?SessionKey=1234` – Joins a specific session directly. Replace `1234` with the actual session key. ### Identity Parameters You can add these parameters to either the **AgentJoin** or **AgentView** STUs to identify the agent. When available, Glance displays this identity to the visitor as the session starts. * `name=User+Name` – displays the user's personal information, including name, email, and phone number, as a courtesy to individuals using Glance to request assistance. * `email=user@example.com` – Displays the user's email. * `phone=(111)222-3333` – Displays the user's telephone number. ### Control Parameters (AgentJoin Only) The AgentJoin URL supports optional parameters to modify its behavior. * `viewersamewindow=1` – Initiates the session viewer within the same browser window that displays the session key prompt. If omitted, Glance launches the viewer in a new window by default. The following optional parameters control the prompt on the AgentJoin page. For more information on configuring these, please contact Glance Customer Success. * `mode=universaljoin` * `mode=chatinvitation` * `mode=smsinvitation` --- ## STUs with Single Sign-On For accounts utilizing **SAML 2.0 Single Sign-On**, you must use SSO-specific STUs. These require an identity provider identifier, which corresponds to the account's numeric Group ID.
Note
In the examples below, we use a Group ID of EXAMPLE. You must replace this with your specific Glance Group ID or Partner ID.
Accessing any SSO STU starts a service-provider-initiated login if the user is not yet signed on. These STUs give direct access to sessions. When a Glance user visits one of these STUs, they immediately see the session page. * `https://www.glance.net/agentjoin/AgentJoin.aspx?idpid=EXAMPLE` – Prompts for a session key. * `https://www.glance.net/agentjoin/AgentView.aspx?idpid=EXAMPLE&SessionKey=1234` – Joins the session directly. Replace `1234` with the actual session key. *You may use the [optional identity parameters](#identity-parameters) mentioned above with these STUs.* To start an interactive session on the Glance **Account Management** page: ```text https://www.glance.net/account/GetLoginKey.aspx?sso=1&idpid=EXAMPLE&redirect=/account/AccountSummary.aspx ``` To obtain a Login Key for use by native client software: ```text https://www.glance.net/account/GetLoginKey.aspx?sso=1&idpid=EXAMPLE ``` To show a SAML troubleshooting page: ```text https://www.glance.net/account/GetLoginKey.aspx?sso=1&test=11&idpid=EXAMPLE ``` For more information on troubleshooting, see the [SAML Troubleshooting Guide](/saml/saml_troubleshooting). ### Alternative identifiers for SSO If you do not wish to use `idpid=EXAMPLE` (Group ID), you can use one of the following alternatives: 1. **Group Name (`idpname`)** Use `idpname=EXAMPLE`. Glance will use the unique group name rather than the number. Replace `EXAMPLE` with your account's group name provided by Glance Support. 2. **Partner Token (`idptoken`)** Use `idptoken=TOKENVALUE`. Glance uses the value from the **Unique Account Identifier** field on the SAML provisioning screen. Replace `TOKENVALUE` with the name you put in that field. This is suitable for Salesforce Organization IDs or Azure tenant names. 3. **Username (`idpusername`)** Use `idpusername=USER.glance.net`. Glance uses the specific username to look up the account group. This is convenient if the group name is unknown. Replace `USER.glance.net` with the Glance Address of any user on the account. ================================================================= FILE: /users/account-management/contact ================================================================= # Contact Support Having trouble? Fill out the form below and our team will get back to you shortly.
{% callout type="warning" title="Note" %} By providing a telephone number and submitting this form you are consenting to be contacted by SMS text message. Message & data rates may apply. You can reply STOP to opt-out of further messaging. {% /callout %} ================================================================= FILE: /users/account-management ================================================================= To log in to Glance to manage your account, follow these steps: 1. Navigate to [www.glance.cx](https://www.glance.cx/#colophon). 2. Click **Login**. Or use the following link: https://www.glance.net/login. ================================================================= FILE: /users ================================================================= # Users and Admin {% callout type="note" title="Note" %} This is a note! {% /callout %}