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:
|
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
|
Set the media tag
Follow these steps to dynamically insert content at player setup:
-
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 Pair Description <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
-
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.
Updated about 17 hours ago