Set an ad via a key-value pair
When your placements have been deployed with the inline embed method, Dynamic Strategy Rules allows you to use a key-value pair to set up the player with a dynamic ad tag or change the dynamic ad tag during a user session.
Prerequisites
Item | Description |
---|---|
Placement ID | Unique identifier for the placement
Follow these steps to obtain the placement ID:
|
Ad Tag URL | URL of the ad to dynamically set |
Set the ad tag
Ad Tag Used at Player Setup
Follow these steps to dynamically insert an ad tag:
-
On a site page, set a key-value pair in the jwDataStore with the ad tag.
This client-side code must occur before the inline embed script for the placement is inserted.
const jwDataStore = window.jwDataStore || { custom: {} }; jwDataStore.custom.abcd1234 = { myPlacementLevelAd: "https://my.ad.com/placement-level-engaging-ad.xml" }; window.jwDataStore = jwDataStore;
Key-Value Pair Description <key> Unique name for the ad tag
Example:myPlacementLevelAd
<value> URL of the ad tag
Example:https://my.ad.com/placement-level-engaging-ad.xml
-
In your JWP dashboard, create an advertising experience for manual ad breaks or a VMAP:
- Enter a default Ad Tag URL. This ad tag will be used when an opportunity occurs on a page that does not have the specified key defined.
This ad tag will be used if the key set in step 2iii is missing from the
DataStore
.Based on the example in step 1, if myPlacementLevelAd is not in your
DataStore
, the ad tag in this field will be served. - Click Use Key for Ad Tag if available. A text field appears.
- Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.
- Enter a default Ad Tag URL. This ad tag will be used when an opportunity occurs on a page that does not have the specified key defined.
Ad Tag Changes across the User Session
Follow these steps to dynamically insert an ad tag:
-
On a site page, set a key-value pair in the jwDataStore with the ad tag.
This client-side code must occur before the inline embed script for the placement is inserted.
const jwDataStore = window.jwDataStore || { custom: {} }; jwDataStore.custom.abcd1234 = { myPlacementLevelAd: "https://my.ad.com/placement-level-engaging-ad.xml" }; window.jwDataStore = jwDataStore;
Key-Value Pair Description <key> Unique name for the ad tag
Example:myPlacementLevelAd
<value> URL of the ad tag
Example:https://my.ad.com/placement-level-engaging-ad.xml
-
In your JWP dashboard, create a trigger:
- For Trigger Type, select Advertising Event.
- For Trigger Event, select Before Play.
- For Event Trigger Frequency, select Every time.
-
Define the event trigger condition:
- From the first dropdown menu, select Player State.
- From the next dropdown menu, select Is.
- From the last dropdown menu, select Idle.
-
Define the trigger action:
- For Action Type, select Advertising.
- For Action, select Change ad breaks. The Configure Ad Breaks section appears.
- Select Change ad breaks manually or VMAP.
Item Selection Action Type Advertising Action Change ad breaks Configure ad breaks Idle
- Select Advertising.
- Select Change ad breaks.
- For the Ad Tag URL, enter a default ad tag URL.
This ad tag will be used if the key set in step 4viii is missing from the
DataStore
.Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.
- Click Use Key for Ad Tag if available. A text field appears.
- Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.
Updated about 2 months ago