Set an ad tag 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 video ad?

Dynamic Strategy Rules let you use key-value pairs to set up the player with a dynamic ad tag or change the ad tag during a user session. By leveraging page context, first-party data, or a customer-managed Prebid auction, you can dynamically generate the most relevant ad tag 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.
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:

  1. On a site page, set a key-value pair in the jwDataStore with the ad tag.

    🚧

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

    const jwDataStore = window.jwDataStore || { custom: {} };
    jwDataStore.custom.abcd1234 = { myPlacementLevelAd: "https://my.ad.com/placement-level-engaging-ad.xml" };
    window.jwDataStore = jwDataStore;
    
    Key-value pairDescription
    <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

  2. In your JWP dashboard, create an advertising experience for manual ad breaks or a VMAP:

    1. 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.

    2. Click Use Key for Ad Tag if available. A text field appears.
    3. Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.



Ad tag changes across the user session

Follow these steps to dynamically insert an ad tag:

  1. On a site page, set a key-value pair in the jwDataStore with the ad tag.

    🚧

    This client-side code must occur before the trigger event occurs.

    const jwDataStore = window.jwDataStore || { custom: {} };
    jwDataStore.custom.abcd1234 = { myPlacementLevelAd: "https://my.ad.com/placement-level-engaging-ad.xml" };
    window.jwDataStore = jwDataStore;
    
    Key-value pairDescription
    <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

  2. In your JWP dashboard, create a trigger:

    1. For Trigger Type, select Advertising Event.
    2. For Trigger Event, select Before Play.
    3. For Event Trigger Frequency, select Every time.
  3. Define the event trigger condition:

    1. From the first dropdown menu, select Player State.
    2. From the next dropdown menu, select Is.
    3. From the last dropdown menu, select Idle.
  4. Define the trigger action:

    1. For Action Type, select Advertising.
    2. For Action, select Change ad breaks. The Configure Ad Breaks section appears.
    3. Select Change ad breaks manually or VMAP.
      Item Selection
      Action Type Advertising
      Action Change ad breaks
      Configure ad breaks Idle

    4. Select Advertising.
    5. Select Change ad breaks.
    6. 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.

      Based on the example in step 1, if myPlacementLevelAd is not in your DataStore, the ad tag in this field will be served.

    7. Click Use Key for Ad Tag if available. A text field appears.
    8. Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.


© 2007- Longtail Ad Solutions, Inc.