Listening for Events
You can listen for events by running the following code:
Upscope('on', ...eventNames, callbackFunction);
List of Events
| Event Name | Additional Arguments | Description |
|---|---|---|
agentsAvailable | — | Indicates that agents are available and waiting for requests on the UserView dashboard. |
agentRequestUpdate | status: "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. |
newObserver | observerId: string, observerData: { id: string; name: string | null; screenWidth: number; screenHeight: number; windowWidth: number; windowHeight: number; hasFocus: boolean;} | Indicates a new agent is observing. |
observerUpdate | observerId: string, observerData: Partial<{ id: string; name: string | null; screenWidth: number; screenHeight: number; windowWidth: number; windowHeight: number; hasFocus: boolean;}> | An observer's data has changed. |
observerGone | observerId: string | observerId is no longer observing. |
observerContentVisible | observerId: string | observerId can now see the content (it is no longer loading). |
observersCount | count: number | Provides 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. |
customMessage | sender: { observer: string } | { visitor: string }, message: Record | A 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")
});
