Documentation

Listening for Events

You can listen for events by running the following code:

Upscope('on', ...eventNames, callbackFunction);

List of Events

Event NameAdditional ArgumentsDescription
agentsAvailableIndicates that agents are available and waiting for requests on the UserView dashboard.
agentRequestUpdatestatus: "pending" | "accepted" | "unavailable" | "canceled"Provides updates about the status of the current agent request.
callAcceptedAn audio call has been accepted by the visitor.
callEndAn audio call has ended.
callStartAn audio call has started.
connectionThe connection has been established with the servers.
connectionResetThe connection has been reset, and a new visitor will be created.
newObserverobserverId: string, observerData: { id: string; name: string | null; screenWidth: number; screenHeight: number; windowWidth: number; windowHeight: number; hasFocus: boolean;}Indicates a new agent is observing.
observerUpdateobserverId: string, observerData: Partial<{ id: string; name: string | null; screenWidth: number; screenHeight: number; windowWidth: number; windowHeight: number; hasFocus: boolean;}>An observer's data has changed.
observerGoneobserverId: stringobserverId is no longer observing.
observerContentVisibleobserverId: stringobserverId can now see the content (it is no longer loading).
observersCountcount: numberProvides an accurate tally of the number of people currently observing.
sessionEndA session has ended.
sessionRequestAn agent is asking to start a session.
sessionContinueA session is continuing from a previous pageview.
sessionStartA session has started.
customMessagesender: { observer: string } | { visitor: string }, message: RecordA custom message sent by an observer or visitor.

Tracking Event Data Such as Clicks

All events originating from the agent will have a isUpscopeBrowserInstruction attribute set to true.

button.addEventListener("click", evt => {
  console.log("Clicked by ", evt.isUpscopeBrowserInstruction ? "agent" : "user")
});