Server-side tracking with server-guided ad insertion (SGAI)
When you use server-guided ad insertion (SGAI), server-side tracking uses a
sessionless beaconing mechanism that differs from the stitched-mode
approach described above. Instead of MediaTailor stitching ad segments into the
content manifest (where it tracks /v1/segment requests), SGAI returns ad
references as separate playlists in an asset list response with beacon metadata embedded
in the ad URIs.
How sessionless server-side beaconing works
The following steps describe how server-side beaconing works for SGAI sessions:
-
Session initialization: The player requests the HLS multivariant playlist with
aws.insertionMode=GUIDED. Server-side reporting is the default (noaws.reportingModeparameter is needed). Unlike stitched mode, the session initialization response does not include atrackingUrl. -
Cacheable manifest: MediaTailor returns a cacheable manifest containing
EXT-X-DATERANGEtags withCLASS="com.apple.hls.interstitial"andX-ASSET-LISTattributes pointing to the MediaTailor interstitial asset list endpoint. -
Asset list with beacon metadata: When the player encounters an ad break, it fetches the asset list. MediaTailor returns a JSON response where each ad URI includes encrypted beacon metadata:
{ "ASSETS": [ { "DURATION": 30.0, "URI": "https://cdn.example.com/ad/master.m3u8?awsBeaconData=<encrypted>&awsBeaconDomain=<MediaTailor-endpoint>&awsConfigurationName=<config-name>" } ] }When server-side reporting is active, the response does not include a
TRACKINGsection. The ad URIs carry all beacon data. -
HLS variable substitution: The player fetches the ad multivariant playlist. The ad manifest uses
#EXT-X-DEFINE:QUERYPARAMdirectives to pass the beacon parameters from the URI query string into segment URLs via HLS variable substitution:#EXTM3U #EXT-X-DEFINE:QUERYPARAM="awsBeaconData" #EXT-X-DEFINE:QUERYPARAM="awsBeaconDomain" #EXT-X-DEFINE:QUERYPARAM="awsConfigurationName" #EXTINF:5.0, {$awsBeaconDomain}/segment/hash/{$awsConfigurationName}/{$awsBeaconData}/0/0?aws.segmentRelativePath=asset_00001.tsThe player resolves the
{$awsBeaconData},{$awsBeaconDomain}, and{$awsConfigurationName}variables using the values from the ad manifest URI query string, and then requests each ad segment through MediaTailor. -
Beacon firing on segment request: As the player requests each ad segment, the request routes through MediaTailor. The service decrypts the beacon data, determines the segment's position within the ad (impression, first quartile, midpoint, third quartile, or complete), and fires the appropriate VAST tracking beacon to the ad server. MediaTailor then redirects the player to the actual ad content segment.
Player requirements for SGAI server-side beaconing
To use server-side beaconing with SGAI, your player must meet the following requirements:
-
HLS version 11 or later
-
Support for
EXT-X-DATERANGEwithCLASSattribute for HLS Interstitials -
Support for
#EXT-X-DEFINE:QUERYPARAMvariable substitution (RFC 8216bis). The player must percent-decode the query parameter values before substituting them into segment URLs.
Note
SGAI server-side beaconing is currently supported for HLS only. DASH is not yet supported for SGAI server-side beaconing.
Comparison with stitched-mode server-side tracking
The following table summarizes how server-side tracking differs between stitched and server-guided ad insertion:
| Aspect | Stitched (SSAI) | Server-guided (SGAI) |
|---|---|---|
| Manifest cacheability | Per-session, not cacheable | Cacheable, shared across viewers |
| Ad segment routing | Through /v1/segment/ using the session
ID |
Through /v1/segment/ using an encrypted beacon
data blob |
| Session state for beacons | Stored per session in MediaTailor | Sessionless — all state is carried in the encrypted
awsBeaconData parameter |
| Tracking URL at session init | Returned in the session initialization response | Not provided — beacon data is embedded in ad URIs in each asset list response |
| DASH support | Supported | Not yet supported |
Note
For live SGAI sessions, you can enable manifest-based ad prefetching using
aws.guidedPrefetchMode=MANIFEST. This is separate from the
schedule-based prefetch API used with stitched (SSAI) sessions. For details,
see Guided prefetch with manifest heartbeating.