Session end
The session end event immediately and irreversibly closes a media tracking session. Session end is a hard close; once sent, the session is terminated and no further events can be tracked under it. Only use Session end when you are certain that no additional events will follow, such as when the player is destroyed or the page is unloaded. In most cases it is safer to allow the session to expire naturally rather than risk cutting off events that might still arrive. If the viewer finishes the content, call Session complete instead.
Without an explicit session end, a session closes automatically after 10 minutes of no events or 30 minutes of no playhead movement.
- Prerequisites: Session start
- Associated metric: None
Recommended implementation types
Call sendEvent with eventType: "media.sessionEnd":
| code language-javascript |
|---|
|
Call trackSessionEnd when the viewer closes the player or navigates away.
| code language-swift |
|---|
|
Call trackSessionEnd when the viewer closes the player or navigates away.
| code language-kotlin |
|---|
|
Call sendMediaEvent with eventType: "media.sessionEnd":
| code language-brightscript |
|---|
|
Call the sessionEnd endpoint:
| code language-sh |
|---|
|
Legacy implementation types (Analytics-only)
Call trackSessionEnd when the viewer closes the player or navigates away:
| code language-javascript |
|---|
|
Call trackSessionEnd when the viewer closes the player or navigates away:
| code language-javascript |
|---|
|
Call mediaTrackSessionEnd when the viewer closes the player or navigates away:
| code language-brightscript |
|---|
|
Send a sessionEnd POST to the events endpoint:
| code language-json |
|---|
|