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

      Enter the on-page key defined for the ad tag to display to the viewer. Using the example in step 1, enter myPlacementLevelAd.

    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-2024 Longtail Ad Solutions, Inc.