Documentation

Listening for Events

AICopy for LLM

You can listen for events by running the following code:

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

List of Events

Event NameAdditional ArgumentsDescription
agentsAvailable—Indicates 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.
callAccepted—An audio call has been accepted by the visitor.
callEnd—An audio call has ended.
callStart—An audio call has started.
connection—The connection has been established with the servers.
connectionReset—The 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.
sessionEnd—A session has ended.
sessionRequest—An agent is asking to start a session.
sessionContinue—A session is continuing from a previous pageview.
sessionStart—A 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")
});