<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br />

Video Ad Targeting is a JWP feature that increases video ad revenues by sending unique content performance and contextual signals to buyers. Implementing through a redirect tag allows you to take advantage of the benefits without setting up header bidding through Prebid.js or JWP's Player Bidding.

<br /> <hr />

## Requirement

ItemNotes
**JW Player media ID**Unique identifier for a JWP video<br /><br />**API approach**:<br /><br />1. Make a [GET https://api.jwplatform.com/v1/videos/list](🔗) call.<br />2. In the API response, locate the `videos[].key` of the applicable video. <hr />**Dashboard approach**:<br /><br />From the <a href="https://dashboard.jwplayer.com/#/content/list" target="_blank">video list page</a>, copy the ID in the **MEDIA ID** column.<br /><br />_If the MEDIA ID column is not exposed, click the gear icon above the list of videos. From the list that appears, select **Media ID**._

<br /> <hr />

## Obtain JWP segments

  1. Add the following **jwvat.js** script tag to your pages. This script creates a global `jwvat` object that exposes a `getSegment` function.



<br />

  1. Add the following code to the `<body>` of your page. Be sure to replace `jwplayer-media-id` with the media ID for a specific video. <br /><br />The `getSegments` function takes three arguments and enables you to fetch the segments of a specified media ID. The segments are returned as an array of strings, `['seg1', 'seg2', 'seg3']`.


ArgumentDescription
**jwplayer-media-id**Unique identifier for a JWP video
**(success callback)**Called with the resulting segments array if the request succeeds
**(error callback)**Called with the following two parameters if the request fails: <br /><br />   • `code`: Numeric error code, see [Error callback parameters](🔗)<br />   • `sourceError`: Root error which caused the failure, see [Error callback parameters](🔗)

<a name="error-callback-parameters"></a> **Error callback parameters**

CodeDescriptionSource Error
**1**Unable to create a request because `XMLHttpRequest` is absent from the context--
**2**Request error, most likely due to a networking issueRoot error
**3**Response status code was not `200`Object containing the HTTP `status` code
**4**Request succeeded but the response did not contain segments--
**5**Response could not be parsedParsing error

<br /> <hr />

## Add targeting information in Google Ad Manager (GAM)

To share JWP's targeting segments with your advertising supplier, you must create a VAST redirect creative with the URL provided to you by your JWP representative.

NOTE

The following instructions are provided to simplify your implementation.<br /><br />GAM is not a JWP product. Aspects of creating a VAST redirect creative within GAM may change. If a step in our instructions does not match your GAM dashboard, please refer to Google's <a href="https://support.google.com/admanager/answer/1171783?hl=en" target="_blank">Traffic a video or audio creative</a> and <a href="https://support.google.com/admanager/answer/1181016?hl=en" target="_blank">Generate video and audio ad tags</a> articles.

<br />

  1. In your GAM dashboard, click **Delivery > Creatives > VAST creatives > New creative**. The **Select advertiser to add creative** pop-up window appears.

  2. Select an advertiser.

  3. Click **OK**.

  4. On the **VAST creative** page, click **Redirect**.

  5. In **Settings**, enter the **Name**, **Target ad unit size**, and **VAST tag URL**. For the VAST tag URL, use the 3rd-party redirect tag provided by your JWP BOOST representative. Be sure that the 3rd-party redirect tag has `&jwpseg=%%PATTERN:jwpseg%%` and <a href="https://support.google.com/admanager/answer/2376981?hl=en#gdpr" target="_blank">GAM’s GPDR macro</a> appended to it.

  6. Click **SAVE**.

  7. Use the following sections to add the Video Ad Targeting to either a [Google Publisher Tag](🔗) or to a [Google VAST ad tag URL](🔗).

<p style="text-align: center">&starf; &starf; &starf;</p>

### Using Google Publisher Tags (GPT)

The following steps are a continuation of the steps in [Add targeting information in Google Ad Manager (GAM)](🔗).

  1. Copy and paste the following code. The `.setTargeting` uses the `jwpseg` values to set the Video Ad Targeting. The `segments.join(',')` converts the segments into a concatenated, comma-delimited string. The `segments` are returned from `jwvat.getSegments()` referenced in the [Obtain JWP segments](🔗) section.


  1. Replace the `/your-network-code/your-ad-unit` placeholder with the Google ad unit.

  2. Replace the `your-div-id` placeholder with the ID of the `<div>` that contains the Google ad unit.

<br />

<p style="text-align: center">&starf; &starf; &starf;</p>

### Using a Google VAST ad tag URL

The following steps are a continuation of the steps in [Add targeting information using Google Ad Manager (GAM)](🔗).

  1. Fill in the necessary information and click **CONTINUE** on the following pages.

  2. Copy the **Video tag** code a notepad.

  3. Add the following code to your page. The `&cust_params=' + encodeURIComponent('jwpseg=' + segments.join(','))` adds and converts the segments into a concatenated, comma-delimited string. The `segments` are returned from `jwvat.getSegments()` referenced in the [Obtain JWP segments](🔗) section.


  1. In the `adTagUrl`, replace `googleAdManagerVideoTag` with the video tag you copied in step 2.

<br /> <hr />

## Add targeting information in another ad server

If you use another platform as your video ad serving platform, ask your video ad serving platform representative how to add macros to an ad tag. Typically, you can add a URL parameter similar to the following: `&jwpseg=[jwpseg]`. Be sure to also add the platform-specific macro for GDPR.

<br />