Enable Video Ad Targeting with a redirect tag

Increase video ad revenues by sending unique content performance and contextual signals to buyers through a redirect tag.

Video Ad Targeting is a JW Player 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 JW Player's Player Bidding.


Requirement

ItemNotes
JW Player media IDUnique identifier for a JW Player video

API approach:

1. Make a GET https://api.jwplatform.com/v1/videos/list call.
2. In the API response, locate the videos[].key of the applicable video.
Dashboard approach:

From the video list page, copy the ID in the MEDIA ID column.

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.


Obtain JW Player segments

  1. Add the following jwvat.js script tag to your pages. This script creates a global jwvat object that exposes a getSegment function.
<script type="text/javascript" src="http://p.jwpcdn.com/boost/jwvat/v/1/jwvat.js"></script>

  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.

    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'].
var jwvat = jwvat || {};
jwvat.que = jwvat.que || [];

jwvat.que.push(function() {
    jwvat.getSegments('jwplayer-media-id', (segments) => {
        // append the segments to your ad request
    }, (code, source) => {
        // error handling
        // code is an error identifier
        // source is the original error- can be undefined
    });
});
ArgumentDescription
jwplayer-media-idUnique identifier for a JW Player 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:

   • code: Numeric error code, see Error callback parameters
   • sourceError: Root error which caused the failure, see Error callback parameters

Error callback parameters

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


Add targeting information in Google Ad Manager (GAM)

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

📘

NOTE

The following instructions are provided to simplify your implementation.

GAM is not a JW Player 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 Traffic a video or audio creative and Generate video and audio ad tags articles.


  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 JW Player BOOST representative. Be sure that the 3rd-party redirect tag has &jwpseg=%%PATTERN:jwpseg%% and GAM’s GPDR macro 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.

★ ★ ★

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 JW Player segments section.
<div id="your-div-id">
    <script>
      googletag.cmd.push(function() {
        googletag.defineSlot('/your-network-code/your-ad-unit', [640, 480],'your-div-id')
          .addService(googletag.pubads())
          .setTargeting("jwpseg", segments.join(','));
        googletag.enableServices();
        googletag.display('your-div-id');
      });
    </script>
</div>
  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.

★ ★ ★

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 JW Player segments section.
jwvat.que.push(function() {
    jwvat.getSegments('your_media_id', (segments) => {
        const adTagUrl = 'googleAdManagerVideoTag&cust_params=' + encodeURIComponent('jwpseg=' + segments.join(','));
        jwplayer.loadAd(adTagUrl);
    });
});
  1. In the adTagUrl, replace googleAdManagerVideoTag with the video tag you copied in step 2.


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.



Did this page help you?