Locate a DAI session ID or debug key

Every user stream is given a session ID, which is saved for six hours after an event. Monitored sessions are saved for 60 days.  You can use this ID in the Stream Activity Monitor (SAM) to see details about the user's ad requests and troubleshoot a video stream.

Use a debug key to view activity or troubleshoot a video stream (Beta) 


You can set or pass a unique key for any stream or session to be able to debug the stream using SAM. If you use the same key across sessions, only the most recent session is searchable and available to debug.

  • Streams requested with the IMA SDK: refer to the SDK documentation for API call to set the key.
  • Streams requested without IMA SDK (SSB): pass a debug key using the dai-sam-id parameter.

    For example: https://dai.google.com/linear/hls/event/.../master.m3u8?dai-sam-id=abcdef-0a1b-12a3

Keys cannot contain any personally-identifiable information.

Find a session ID in an app that uses the IMA SDK

When you use the IMA SDK to create a video stream, you can call a method to obtain the session ID. See details about how to obtain the ID on each platform’s SDK:

Many application developers choose to capture the session ID and log it so that it’s available for stream troubleshooting.

Because the session ID is essential to look up details about ad delivery in a user’s stream, it is helpful to implement a method or hidden feature in your application to easily display the ID.

Find a session ID when you inspect HTTP traffic

You can monitor HTTP requests in a proxy tool from an application that uses the IMA SDK.

When you use the IMA SDK to request a Dynamic Ad Insertion (DAI) video stream, there are two HTTP requests:

  • The HTTP POST, which should return with a 201 status, indicating that a new stream has been created.
  • The HTTP GET request to the URL in the stream_manifest field. *

Additional information is returned in a JSON structure, including the stream_id. This is the session ID you should use in the Stream Activity Monitor (SAM) in Ad Manager.

Find a session ID from an emulated HTTP request

You can emulate an SDK HTTP request sequence using curl from a command-line prompt, with the content ID and video ID from a video on demand stream URL.

For example, using a content ID of 12345 and video ID of sample-video:

  1. Type the following from a command-line prompt:

    curl --data "" "http://dai.google.com/ondemand/hls/content/12345/vid/sample-vide/streams"

  2. (Optional) Pipe to  python -mjson.tool   to view in pretty print.

Sample output *


{
"duration": 784,
"stream_id": "19b40be0-7942-44ca-97e0-fc7b27f14029",
"stream_manifest": "https://dai.google.com/ondemand/hls/content/12345/vid/sample-video/CHS/streams/19b40be0-7942-44ca-97e0-fc7b27f14029/master.m3u8",
"stream_type": "on_demand",
"subtitles": [ ... ],
"time_events_url": "https://dai.google.com/ondemand/hls/content/12345/vid/sample-video/CHS/streams/19b40be0-7942-44ca-97e0-fc7b27f14029/time-events.json"
}

* You may be able to use the stream_manifest URL to test playback in an HLS player (for example, the Safari web browser).

Find a session ID in an SSB stream request

When you use SSB to request a Dynamic Ad Insertion (DAI) video stream, there are two HTTP requests:

  1. The HTTP GET request, which should return with a 302 status, indicating a redirect.
  2. The HTTP GET request to the redirected URL. This URL contains the "session ID" which you should use in the Stream Activity Monitor (SAM) in Ad Manager.

You can also find a session ID when you monitor HTTP requests in a proxy tool from a mobile or OTT application.

Find a session ID for an SSB stream request using Chrome

  1. Load the content stream URL in a browser.

    For example, using a content ID of 12345 and video ID of sample-video, load:
    http://dai.google.com/ondemand/hls/content/12345/vid/sample-video/master.m3u8

  2. In Chrome, load Developer Tools.
  3. Navigate to the "Network" tab of Developer Tools.
  4. Filter for requests that include dai.google.com.
  5. The first two requests to the "dai.google.com" domain should be for a file named "master.m3u8":

    First request: The 302 response

    Second request: The URL with the session ID

  6. Copy the session ID to use in the Stream Activity Monitor (SAM) in Ad Manager.
Was this article helpful?
How can we improve it?