Set a media item via a key-value pair

Trigger ad tag updates based on real-time viewer and page data

Once you’ve deployed your Dynamic Strategy Rules placements, how can you ensure each viewer sees the most relevant content?

Dynamic Strategy Rules let you use key-value pairs to load a specific media item into the player. By leveraging page context or first-party data, you can dynamically insert the most relevant media item when the page renders.



Prerequisites

Item Description
Placement ID Unique identifier for the placement

Follow these steps to obtain the placement ID:
  1. On the Dynamic Strategy Rules page, on the Placements tab, click the name of the placement. The placement details page appears.
  2. In the row of the placement, copy the ID under the Placement ID column.
Content ID or URL of the media item or playlist to dynamically set

Media ID
In your Media library, copy the Media ID for a media item.

Playlist ID
In your Playlists page, copy the Playlist ID for a playlist.

Playlist URL
  1. On the Playlists page, click the name of a playlist. The playlist details page appears.
  2. On the Developers tab, copy the JSON URL.


Set the media tag

Follow these steps to dynamically insert content at player setup:

  1. On a site page, set a key-value pair in the jwDataStore with the JWP media item or playlist URL.

    🚧

    This client-side code must occur before the placement embed script loads the player.

    const jwDataStore = window.jwDataStore || { custom: {} };
    jwDataStore.custom.abcd1234 = { myPlacementLevelMedia: "zyxw0987" };
    window.jwDataStore = jwDataStore;
    
    const jwDataStore = window.jwDataStore || { custom: {} };
    jwDataStore.custom.abcd1234 = { myPlacementLevelMedia: "https://cdn.jwplayer.com/v2/sites/1234abcd/media/zyxw0987/playback.json" };
    window.jwDataStore = jwDataStore;
    
    Key-Value PairDescription
    <key>Unique name for the media item or playlist

    Example:myPlacementLevelMedia
    <value> ID or URL of the media item or playlist

    Examples:
    • zyxw0987
    • https://cdn.jwplayer.com/v2/sites/1234abcd/media/zyxw0987/playback.json

  2. In your JWP dashboard, define a Media curation configuration.

    📘

    In step 3 of defining the Media curation configuration, select Use key for media if available or Use key for playlist if available and enter the on-page key defined for the content to display to the viewer.

    Based on the example in step 1, if myPlacementLevelMedia.



© 2007- Longtail Ad Solutions, Inc.