Provide custom data to a placement

Learn how to add custom data to a placement

Custom data can be added for a specific placement. These parameters apply to a specific placement, such as a placement-level behavior. Key names are defined on the Key value pairs page.



Prerequisite

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.


Add custom data

There are several approaches to add custom data for a placement: query parameters, HTML attributes, and jwDataStore. The following sections explain how to use each approach.


Query Parameters

Custom data is added through a query string appended to the embed URL.

Topic Details
ParsingOnly at page load
Supported Data TypesStrings
Requirements
  • Placement-level key-value pairs (KVPs) are prefixed with custom.{placement-id}, such as custom.abcd1234 in the example below.
  • Key names must start with a lowercase letter and contain only lowercase letters, numbers, and underscores.
Data Override RulesOverridden by:
  • HTML Attributes
  • jwDataStore
Example
&custom.abcd1234.view_type=advert



HTML Attributes

⚠️

This approach is required for the header method.


Custom data is added through data attributes added to a JWX placement <div> element.

Topic Details
ParsingOnly at page load
Supported Data TypesStrings
Requirements
  • The JWX placement has data-jw-placement-id defined.
  • Placement-level KVPs are prefixed with data-jw-
  • Key names must start with a lowercase letter and contain only lowercase letters, numbers, and underscores.
Data Override RulesOverrides:
  • Query Parameters
Overridden by:
  • jwDataStore
Example
<div 
    id="jwp-placement-1"
    data-jw-placement-id="plac1234"
    data-jw-media_id_1="medi1234"
    data-jw-playlist_id_1="play1234">
</div>



jwDataStore

Custom data is added through attributes added at the page level.

Topic Details
ParsingAt every rule evaluation
Supported Data TypesAll types
Requirements
  • Placement-level KVPs are stored in jwDataStore.custom.{placement-id}, such as jwDataStore.custom.abcd1234 in the example below.
  • Key names must start with a lowercase letter and contain only lowercase letters, numbers, and underscores.
Data Override RulesOverrides:
  • Query Parameters
  • HTML Attributes
Example
const jwDataStore = window.jwDataStore || { custom: {} };
jwDataStore.custom.abcd1234 = { view_type: "advert" };
window.jwDataStore = jwDataStore;


Did this page help you?
© 2007- Longtail Ad Solutions, Inc.