Assigning Ad Sets Dynamically

You can override a Backlot ad set with one that you specify at runtime.

Enabling Dynamic Ad Sets

Contact your Ooyala support representative to enable the dynamic ad set code feature for your account.

JavaScript Functions Used to Assign Ad Sets Dynamically

Use the following Player V4 JavaScript functions to specify an ad set at runtime. Each ad set has a unique ad set code identifier (adSetCode parameter), which you pass to identify the ad set when assigning it dynamically.
Type Description
OO.Player.setEmbedCode Assign an ad set to a specific embed code.
OO.Player.create Assign an ad set to a specific player and video asset.

Step 1: Set up the adSetCode in Backlot

First, you need to set up the adSetCode in Backlot.
Note: The ad set code is not available by default for security reasons. Contact your Ooyala support representative to enable this feature.
  1. In the Backlot UI, associate an ad set with a video asset.
  2. Retrieve the adSetCode. The following figure shows an example of this association, along with the Ad Set Code that you create in the MONETIZE tab.

Step 2: Specify the adSetCode on the Web Page

Associating an Ad Set with a Player and Video Asset

To associate the ad set with a particular player and video asset, use the OO.Player.create function to generate a player and add the parameter adSetCode with the ad set code value retrieved from step 1.
<script>
    var playerParam = {
        "pcode": "YOUR_PCODE",
        "playerBrandingId": "YOUR_PLAYER_ID",
        "skin": {
            // Config contains the configuration setting for player skin. Change to your local config when necessary.
            "config": "url_where_hosted/skin.json"
        },
        adSetCode: "yourAdSetCode"
    };
    OO.ready(function() {
        window.pp = OO.Player.create("container", "YOUR_ASSET_ID", playerParam);
    });
</script>

Associating an Ad Set with an Embed Code

To assign an ad set to a specific embed code, use the setEmbedCode function. The setEmbedCode function takes an additional options parameter, which must be an object and must belong to the same provider as the embed code. In the options hash, use the adSetCode parameter with the ad set code value retrieved from step 1, as shown in the following example.
<script>
    player.setEmbedCode(embedCode, {
        adSetCode: "yourAdSetCode"
    }); 
<script>

해당 내용이 도움 되었습니까?