Let's Chat?

One-Click Connect

One-Click Connect allows a support agent to:

  • See basic information about what the Visitor is doing with the application.
  • Remotely initiate a screen share session for an application user.

Presence must be configured for your group by Glance Support before you can use the Presence functionality in your application.

To support One-Click Connect, an application must connect to the Glance Presence Service in order to receive messages relayed by the Agent. Each application user must connect with his own unique Visitor ID.

The One-Click Connect API is implemented on Glance.PresenceVisitor.

Typically an application will connect to the Presence service while the Visitor is logged into the application, and will disconnect when the Visitor logs out or exists the application.

You should make all PresenceVisitor API calls from the main thread.

Default UI for Mobile

The Glance SDK provides a Default UI on mobile platforms for sessions initiated via One-Click. When an Agent initiates a session via One-Click:

  • A confirmation message is displayed in the mobile.

  • If the visitor clicks Accept, a session starts using the visitor ID as the session key.

  • Glance logs if the visitor clicks Accept or Decline.

Initialization

See the documentation for Glance.Visitor.init. Before connecting to the Glance Presence service, an application must call Glance.Visitor.init with a Visitor ID.

  • The same Visitor ID should be used when the same visitor is logged into the application on another device, or in a web application instrumented for Glance One-Click Cobrowse.
  • Only one user can be signalable by the One-Click service at a time with a given Visitor ID.
  • If two application instances connect using the same Visitor ID, the most recently active application has “focus” and will receive any signals sent by the Agent.
  • By default, the Visitor ID will also be used as the session key for any screensharing session started with StartSession().
  • The application should wait for EventVisitorInitialized to fire before calling Glance.PresenceVisitor.connect.

Connecting to Presence

GlancePresenceVisitor connect(pushNotifications)

The Visitor must be connected to send presence information or receive signals from the Agent.

Once EventVisitorInitialized has fired, the application may call GlancePresenceVisitor connect to connect to the presence service. The application should wait for the EventPresenceConnected event before attempting to call any additional GlancePresenceVisitor methods.

The application may also receive EventPresenceConnectFail or EventPresenceNotConfigured if there is an error connecting to the Presence service.

For mobile platforms only: if pushNotifications is true, the application will request permission to send push notifications, if not already granted. This allows the application to be signaled even when running in the background. See “Background / Foreground” Transitions.

If the SDK is already connected, calling connect() again does nothing.

While connected to the Presence service, the application will notify the service about various visitor side events:

Event Data Agent Side Event
visitorerror
e.g. no gserver configured for sdk version
“code”:”conndrop”
”msg”:”Connect failed”,”params”:
onvisitorerror
visitorsessionstart onvisitorsessionstart
visitorsessionend “reason”:error_message onvisitorsessionend
visibility hidden (background)
visible (foreground)
onvisibility

GlancePresenceVisitor disconnect

To disconnect from the Presence service, typically on logout or application exit, the application should call Glance.PresenceVisitor.disconnect.

NOTE: If the connection to the presence service drops, the Glance SDK automatically reconnects.

Presence Events

Event Type Description
EventPresenceConnected Info The Glance SDK successfully connected (or reconnected after a connection drop) to the presence service.
EventPresenceConnectFail Warning The connection to the Presence service has dropped. The Glance SDK will automatically attempt to reconnect, and will fire EventPresenceConnected once reconnected. The event properties include:
- reason: Diagnostic text message suitable for logging. Applications can continue to call presence() and signal methods anyway, as those methods will retry the connection.
EventPresenceShowTerms Info The Agent has signaled the Visitor to display a screen share Terms and Conditions dialog box. If the Visitor agrees to the terms, the application should start a screen share session. This event only needs to be handled if not using the Default UI.
Properties:
– sessionkey: The key to use for the session, if the user agrees to start
– onetermsurl: A link to the terms and conditions web page that should be displayed in the dialog box.
EventPresenceSignal Info A signal was received from the Agent. In a future implementation, this event can be used to handle custom signals from the Agent.
EventPresenceBlur Info Another application or web page has connected to the Presence service, and this application is losing focus. The application will automatically regain focus the next time presence, signalAgent, or signalVisibility is called.
EventPresenceSendFail Warning A signal could not be sent to the Agent because the connection to the presence service is currently down.
EventPresenceNotConfigured Warning Presence is disabled for the group or is not correctly configured.
EventPresenceDisconnected Info The Glance SDK has successfully disconnected from the Presence service.
glancePresenceDialogDidTapYes Info The visitor tapped Accept within the presence terms dialog.
glancePresenceDialogDidTapNo Info The visitor tapped Decline within the presence terms dialog.

Monitoring User Activity

Glance.PresenceVisitor.presence(map<string, string>data)

When Presence is connected, information can be sent to the agent side as the user navigates through the application. The Agent side CRM integration can display this information to let the Agent know what the user is doing in the application.

data is a property map which is delivered to the Agent as a JSON object in the onpresence event. Standard properties that may be in the data map are:

  • url: A string indicating what area of the application the visitor is currently using.

Calls to presence() can result in EventPresenceSendFail events if the Glance SDK happens to be temporarily disconnected from the presence service at the time presence is called. The Glance SDK does not queue presence messages to be resent upon reconnect.

You may specify custom properties in the call to presence(), but they must be prefixed with “c_” to prevent conflicts with standard properties.

Presence is not intended to transfer large data sets. The maximum number of properties allowed is 20 with a limit of 2,000 characters per property and 10,000 total size. The maximum length of a property name is 64 characters. Attempting to send presence data which exceeds these limits results in an EventInvalidParameter event.

An application may call presence() whenever a visitor accesses a new area of the application. This allows an Agent to see what area of the application a visitor is using, even before establishing the screenshare session.

If an application’s connection has been “blurred” by another application, calling presence() causes the application to reconnect to presence and take focus. A best practice is to only call presence() when a user interacts with the application. presence() should be called on average no more than once per minute for typical application usage.

Background / Foreground Transitions

Passing visibility information to the Presence Service allows the Agent to be informed as to whether the Visitor is actively using the application.

For mobile platforms, the Glance SDK will automatically notify the Agent as the application is moved into background or foreground operation.

Desktop applications must call signalVisibility.

GlancePresenceVisitor SignalVisibility(visible)

For desktop platforms, call Glance.PresenceVisitor.SignalVisibility to let the Presence Service know when the application moves to the background or foreground. Pass visible = false when the application is deactivated, and visible = true when the application is activated.

When the application is not visible, the Visitor continues to appear present on the Agent side, and the application is signalable, for as long as allowed by the operating system up to a maximum of ten minutes.

Signaling a mobile application in the background requires that push notifications be enabled.

GlancePresenceVisitor SignalAgent(eventName, eventProperties)

Notifies the Agent about something that happened on the Visitor side.

Events that are recognized by standard Glance CRM integrations:

Event Name Event Properties
“terms” “status” : [“displayed”|”accepted”|”declined”]

Custom events may be sent using signalAgent. However any custom events must be prefixed with “c_” to avoid potential conflicts with the Glance event namespace.

Creating a Custom UI

The SDK provides a default user interface to request confirmation and show Terms and Conditions. The URL to a Terms web page is configured in the agent-side CRM system.

To provide your own UI, after calling connect pass false to GlancePresenceVisitor.setDefaultUI.

Then handle the EventPresenceShowTerms event. In your event handing you should:

  1. Display your terms and conditions and options to accept (start screen share) or decline.
  2. Notify the agent terms have been displayed by calling Glance.PresenceVisitor.signalAgent("terms", {"status":"displayed"}).
  3. Notify the agent of accept or decline by calling Glance.PresenceVisitor.signalAgent("terms", {"status":"accepted"}).
  4. On accepting, call Glance.Visitor.StartSession with StartParams having presenceStart set to true. Example:
// pseudo code, will vary by programming language
Glance.StartParams sp = new Glance.StartParams();
sp.key           = visitorId;
sp.presenceStart = true;
Glance.Visitor.StartSession(sp);

Platform-specific examples of custom user interface are provided in the glance-networks gitlab repository.

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