Chapter offset

This page covers data collection for the Chapter offset variable. See Chapter offset for the corresponding reporting dimension.

The chapter offset variable is the offset of the chapter inside the content, measured in seconds from the start. The first chapter typically has offset 0; subsequent chapters have offsets matching their playhead start time.

Property
Value
Context data variable
a.media.chapter.offset
XDM collection field
xdm.mediaCollection.chapterDetails.offset
Audience Manager trait
c_contextdata.a.media.chapter.offset
Required
No (Mobile SDK); Yes (Edge, Media Collection API)
Sent with
Chapter start, chapter close
Web SDK

Set offset inside xdm.mediaCollection.chapterDetails when calling sendEvent:

code language-javascript
alloy("sendEvent", {
  xdm: {
    eventType: "media.chapterStart",
    mediaCollection: {
      chapterDetails: {
        friendlyName: "Act II",
        index: 2,
        offset: 240,
        length: 360
      },
      sessionID: "{sid}",
      playhead: 240
    }
  }
});
iOS

Pass the offset in seconds as the fourth argument (startTime) to createChapterObject.

code language-swift
let chapterObject = Media.createChapterObjectWith(name: "Act II",
                                              position: 2,
                                                length: 360,
                                             startTime: 240)

tracker.trackEvent(event: MediaEvent.ChapterStart, info: chapterObject, metadata: nil)
Android

Pass the offset in seconds as the fourth argument (startTime) to createChapterObject.

code language-kotlin
val chapterObject = Media.createChapterObject("Act II",
                                              2L,
                                              360.0,
                                              240.0)

tracker.trackEvent(Media.Event.ChapterStart, chapterObject, null)
Roku

Set offset inside xdm.mediaCollection.chapterDetails when calling sendMediaEvent for media.chapterStart:

code language-brightscript
m.aepSdk.sendMediaEvent({
    "xdm": {
        "eventType": "media.chapterStart",
        "mediaCollection": {
            "chapterDetails": {
                "friendlyName": "Act II",
                "index": 2,
                "offset": 240,
                "length": 360
            },
            "playhead": 240
        }
    }
})
Media Edge API

Call the chapterStart endpoint with offset inside xdm.mediaCollection.chapterDetails:

code language-json
{
  "events": [{
    "xdm": {
      "eventType": "media.chapterStart",
      "mediaCollection": {
        "chapterDetails": {
          "index": 2,
          "offset": 240,
          "length": 360
        },
        "sessionID": "{sid}",
        "playhead": 240
      }
    }
  }]
}

Legacy implementation types (Analytics-only)

Media SDK JS 3.x

Pass the offset as the fourth argument to ADB.Media.createChapterObject:

code language-javascript
var chapterInfo = ADB.Media.createChapterObject(
  "Act II",
  2,
  360,
  240
);

tracker.trackEvent(ADB.Media.Event.ChapterStart, chapterInfo, contextData);
Chromecast

Pass the chapter offset in seconds as the fourth argument (startTime) to ADBMobile.media.createChapterObject:

code language-javascript
var chapterInfo = ADBMobile.media.createChapterObject(
  "Pilot Episode - Opening",  // name
  1,                          // position
  240,                        // length
  0                           // startTime (seconds from content start)
);
ADBMobile.media.trackEvent(ADBMobile.media.Event.ChapterStart, chapterInfo, null);
Media Collection API

Include media.chapter.offset in the params object of your chapterStart POST request:

code language-json
{
  "playerTime": { "playhead": 240, "ts": 1699523820000 },
  "eventType": "chapterStart",
  "params": {
    "media.chapter.offset": 240
  }
}

See the Media Collection API events reference for the full request structure.

recommendation-more-help
media-analytics-help