Session complete

The session complete event signals that the viewer reached the end of the main content. It does not immediately close the session; the session remains open until it expires naturally. If you want to immediately close the session, call Session end instead.

Web SDK

Call sendEvent with eventType: "media.sessionComplete":

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.sessionComplete",
    mediaCollection: {
      sessionID: "{sid}",
      playhead: 128
    }
  }
});
iOS

Call trackComplete when the media player reaches the end of content.

code language-swift
tracker.trackComplete()
Android

Call trackComplete when the media player reaches the end of content.

code language-kotlin
tracker.trackComplete()
Roku Edge

Call sendMediaEvent with eventType: "media.sessionComplete":

code language-brightscript
m.aepSdk.sendMediaEvent({
    "xdm": {
        "eventType": "media.sessionComplete",
        "mediaCollection": {
            "playhead": 128
        }
    }
})
Media Edge API

Call the sessionComplete endpoint:

code language-sh
curl -X POST "https://edge.adobedc.net/ee/va/v1/sessionComplete?configId={datastreamID}" \
--header 'Content-Type: application/json' \
--data '{
  "events": [{
    "xdm": {
      "eventType": "media.sessionComplete",
      "mediaCollection": {
        "sessionID": "{sid}",
        "playhead": 128
      },
      "timestamp": "YYYY-08-20T22:41:40+00:00"
    }
  }]
}'

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Call trackComplete when the media player reaches the end of content:

code language-javascript
tracker.trackComplete();
Chromecast

Call trackComplete when the media player reaches the end of content:

code language-javascript
ADBMobile.media.trackComplete();
Roku 2.x

Call mediaTrackComplete when the media player reaches the end of content:

code language-brightscript
ADBMobile().mediaTrackComplete()
Media Collection API

Send a sessionComplete POST to the events endpoint:

code language-json
{
  "playerTime": { "playhead": 128, "ts": 1699523820000 },
  "eventType": "sessionComplete"
}
recommendation-more-help
media-analytics-help