> For the complete documentation index, see [llms.txt](https://docs.relevant-digital.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.relevant-digital.com/technical/integration/formats-and-channels/instream-video-with-hbm-and-gam.md).

# Instream video with HBM and GAM

Run instream video auctions with HB Manager and Google Ad Manager.

One Prebid auction can load banner and instream placements together. This allows pre-roll inventory to load alongside display inventory.

### Before you begin

{% hint style="warning" %}
Google Ad Manager needs separate line items for in-player video creatives. Contact Relevant Yield Support if you need them created.
{% endhint %}

### 1. Add Prebid modules

Your Prebid build needs these modules:

* **dfpAdServerVideo** — Required for this integration.
* **instreamTracking** — Optional. Enables instream revenue in Headerbid Analytics reports.

{% hint style="info" %}
The IMA SDK may not report instream tracking automatically. Use [relevantDigital.Auction.registerImpressionByAdId()](/technical/integration/javascript-api/relevantdigital.auction.registerimpressionbyadid.md) when you must register impressions manually.
{% endhint %}

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/instream-docs/1.png" alt="1" width="670">

1. Select **Global programmatic tag**.
2. Select **Manage builds**.
3. Open the Prebid build you want to update.

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/instream-docs/2.png" alt="2" width="669">

4. Add **dfpAdServerVideo** and, optionally, **instreamTracking** under **Extra modules**.
5. Click **Save**. The build completes in a few minutes.

### 2. Create an instream placement type

Create a placement type with **Instream video** as its type.

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/instream-docs/3.png" alt="3" width="670">

Add a dimension to set the default `playerSize`.

Override it through **Instream video settings** in **Prebid parameters** when needed.

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/instream-docs/4.png" alt="4" width="670">

{% hint style="info" %}
Instream settings describe inventory to SSPs. They do not control the video player.
{% endhint %}

### 3. Add instream placements

Add placements as usual, then select the instream placement type.

<img src="https://4674099.fs1.hubspotusercontent-na1.net/hubfs/4674099/instream-docs/5.png" alt="5" width="670">

Add the placement to the site's normal Prebid configuration.

### 4. Implement the player integration

This example uses the **Brid.TV** player. The same workflow applies to other players.

1. Create video slots with [relevantDigital.defineVideoSlots()](/technical/integration/javascript-api/relevantdigital.definevideoslots.md). Create slots once per page. You can reuse a GAM ad-unit path for multiple pre-roll videos.
2. Load ads with [relevantDigital.loadPrebid()](/technical/integration/javascript-api/relevantdigital.loadprebid.md).
3. Use [relevantDigital.loadVideoUrls()](/technical/integration/javascript-api/relevantdigital.loadvideourls.md) to receive VAST URLs for the player.

#### Brid.TV example

{% code title="instream-video.html" expandable="true" collapsedlinecount="12" %}

```html
<html>
<body>
<script src="//services.brid.tv/player/build/brid.min.js"></script> 
<script async src="https://zee-cdn.relevant-digital.com/static/tags/6204e5fa70e3ad10821b84ff.js"></script>
Instream Video
<div id="playerDiv" class="brid" style="width:640;height:408;"></div>
<script>
window.relevantDigital = window.relevantDigital || {};
relevantDigital.cmd = relevantDigital.cmd || [];
relevantDigital.cmd.push(() => {
    relevantDigital.addPrebidConfig({ consentManagement: { cmpApi: 'none' } }); // JUST for this test-page!!!
    
    /** Define "video slots", the concept is similar to using <div data-ad-unit-id="??"> or calling
     * googletag.pubads().defineSlot([path], ..) manually - except that they doesn't correspond to any <div>.
     * But the ids (obtained by getSlotElementId()) can be used e.g. as the allowedDivIds parameter to loadPrebid
     */
    const PRE_ROLL_IDS = relevantDigital.defineVideoSlots([
        { path: '/19968336/prebid_cache_video_adunit' },
    ]).map((s) => s.getSlotElementId());
    

    // Call relevantDigital.loadPrebid() "as normal", this will also load the video slots we created.
    relevantDigital.loadPrebid({
        configId: '6204e83a077c5825441b8508',
        manageAdserver: true,
        // allowedDivIds: PRE_ROLL_IDS, // uncomment this line to *only* load our pre-rolls
    });
    
    // Wait for the "video slots" to be loaded, order of this call and relevantDigital.loadPrebid() doesn't matter
    // Notice however that if no corresonding relevantDigital.loadPrebid() call is made, the callback will not be called
    relevantDigital.loadVideoUrls(PRE_ROLL_IDS, (urls) => $bp("playerDiv", {
        id: "33423",
        width: "640",
        height: "480",
        playlist: "18250",
        Ad: [{
            adType: "0", // pre-roll
            adTimeType: "s",
            // Use Brid parser, instead of IMA SDK to make header bid analytics (HBA) work out of the box.
            // With the IMA SDK, register impressions manually for HBA.
            adTagUrl: urls.map((url) => url + "&brid_parser=brid"), // Use Brid parser, instead of IMA SDK to make Header bid reports work (optional)
        }],
    }));
});
</script>
</body>
</html>
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.relevant-digital.com/technical/integration/formats-and-channels/instream-video-with-hbm-and-gam.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
