OpenWrap In-App OTT
The sections below provide details about the parameters and usage notes for building OpenWrap video ad tags in GAM AdServer.
DFP is now called, Google Ad Manager (GAM)…
When you see DFP mentioned in this guide, remember that it is referring to GAM.
In-App OTT header bidding
To support header bidding for OTT mobile apps, OpenWrap supports a REST API that fetches bids for a video ad slot and returns those bids as a set of targeting keys that can be passed to the ad server. The following steps describe how to call this API and send the returned targeting keys to GAM. While the most common use case for this REST API is for In-App header bidding for OTT video, it can be used on any platform.
Step 1: Setup OpenWrap Profile
Create an OpenWrap profile with OTT/CTV selected as the Platform type. Then configure bidders, map ad units, and push the profile live. See OpenWrap Profile Management for details on how to create a profile and map ad units.
Step 2: Make a call to OpenWrap ahead of call to ad server to fetch bids.
OpenWrap will return bid(s) for the video slot in the form of targeting keys.
Sample OpenWrap request URL:
https://ow.pubmatic.com/openrtb/2.5/video?pubId=156276&profId=1187&adserver=DFP&pwtplt=video&pwtmime=1&f=json&pwtm_iu=%2F40619304%2FOW_Video&pwtm_sz=640x480&pwtm_url=https%3A%2F%2Fwww.pubmatic.com.com%2F
The parameters for the OpenWrap video request are all sent as URL parameters. Accurate and complete video parameters are essential for achieving good yield. Please work with your PubMatic customer success manager to make sure you have the correct set of parameters.
If there is no bid the OpenWrap server will return still return a JSON document but your code should still handle error cases such a no response at all or non-200 HTTP response codes.
When making the call to OpenWrap, always set a timeout in your code in case the call doesn’t complete. While OpenWrap will respect the timeout specified in the profile, the call from the client may not complete in the maximum time due network or other issues.
In addition to these in-app OTT parameters, you can refer to the OpenWrap Query Parameters parameters above.
In-app OTT parameter name | Type | Description | Example Value |
f | String | Format of response to return. | f=json Note: Pass this parameter to specify response format. If value of this parameter is 'json' then response would be returned in JSON format containing only 'targeting' field. For any value other than 'JSON', redirect response will be sent with redirect url, unless debug is true. If value of this parameter is 'json' then 'owredirect' param is optional. If 'owredirect' parameter has not been passed then following additional parameters need to be passed: These parameters are used for macro replacement and override values in owredirect if present. |
pwtm_iu | Inventory unit (ad unit) This is the ad unit value OpenWrap uses for mapping to demand partner parameters. As GAM ad unit ids have ‘/’, it’s important to correctly URL encode this value | pwtm_iu=%2F40619304%2FOW_Video | |
pwtm_sz | Video player size | pwtm_sz=640x480 | |
pwtm_url | Page URL
| pwtm_url=https%3A%2F%2Fwww.pubmatic.com.com%2F | |
pwtbidrprm | Encoded JSON string | Bidder specific key-value for AppNexus amn PubMatic. | Sample JSON with key-values: Bidder JSON { "pubmatic": { "keywords": [{ "key": "dctr", "value": ["val1", "val2"] }] }, "appnexus": { "keywords": [{ "key": "key1", "value": ["val1", "val2"] }, { "key": "key2", "value": ["val1"] } ] } } |
pwtvapi | Use 7 to indicate OMID-1 (Open Measurement Support) | pwtvapi=7 |
Step 3: Parse the response from OpenWrap
When bidding is successful, OpenWrap will return an HTTP 200 with JSON document.
The targeting keys for OpenWrap’s video bid are located under the targeting field in the returned JSON document.
Sample JSON:
{ "targeting": { "pwtbst": "1", "pwtcid": "6ffb3535-4574-46e0-ae4d-6d1955e5a2b2", "pwtcpath": "/cache", "pwtcurl": "https://ow.pubmatic.com", "pwtecp": "3.00", "pwtpid": "pubmatic", "pwtplt": "video", "pwtprofid": "1187", "pwtpubid": "156276", "pwtsid": "/40619304/OW_Video", "pwtsz": "0x0" } }
Step 4: Append targeting keys to your GAM (or other ad server) VAST URL
These instructions cover GAM. The concepts are the same for any other ad server, but the details of passing the targeting keys will differ for other ads servers.
You'll need to take the targeting keys we get from OpenWrap and add them to the VAST ad tag URL that GAM will be called with.
Here’s an example GAM URL without targeting keys:
Targeting keys are passed in the cust_params
URL parameter. cust_params
contain the URL keys encoded as a url query string. Since cust_params
is part of a url query string itself, we have a url query string within a url query string.
Here’s an example GAM URL with targeting keys:
You'll notice the value of cust_params
is %26
; this value separates the different targeting keys. The %26
is a url encoded version of '&.
Because the value of cust_params
requires two levels of url encoding, we recommend using a url code library to construct the url.
If you are already passing custom targeting keys to GAM, you’ll need combine your existing targeting keys and OpenWrap’s targeting keys in the cust_params
field.
cust_params
is Prebid.jsStep 5: Pass augmented URL to Ads SDK
The VAST url augmented with targeting keys is now passed to the video ads SDK as normal. In many cases, the ads SDK will be IMA, but this approach will work with other ads SDKs.
Additional Requirements:
For the ad server to utilize the targeting keys, line items need to be setup in the ad server. Contact your PubMatic customer success manager to arrange for line item set up.
OpenWrap Query Parameters
URI | Request |
---|---|
http://ow.pubmatic.com/openrtb/2.5/video/ | GET |
oRTB Video Request parameter | OpenWrap Parameter | Parameter Type | Notes | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
API | pwtvapi | |||||||||||||||||||||
BAttr | pwtbatr | |||||||||||||||||||||
BoxingAllowed | pwtbox | |||||||||||||||||||||
Delivery | pwtdvry | |||||||||||||||||||||
H | pwtvsz | W and H would be provideed in pwtvsz or sz in the format: WxH | ||||||||||||||||||||
Linearity | pwtvlin | linear=1,nar=2 | ||||||||||||||||||||
MinBitrate | pwtmnbr | |||||||||||||||||||||
MaxBitrate | pwtmxbr | |||||||||||||||||||||
MinDuration | pwtvmnd | |||||||||||||||||||||
MaxDuration | pwtvmxd | |||||||||||||||||||||
MaxExtended | pwtmxex | |||||||||||||||||||||
Mimes | pwtmime | List of Integers; for example, | Possible Integer values for pwtmime and their corresponding meaning:
| |||||||||||||||||||
Placement | pwtvplc | |||||||||||||||||||||
PlaybackMethod | pwtplbk |
| ||||||||||||||||||||
Pos | pwtvpos | |||||||||||||||||||||
Protocol | pwtprot | |||||||||||||||||||||
Protocols | pwtprots | |||||||||||||||||||||
Sequence | pwtseq | |||||||||||||||||||||
Skip | pwtskp | |||||||||||||||||||||
SkipMin | pwtskmn | |||||||||||||||||||||
SkipAfter | pwtskat | |||||||||||||||||||||
StartDelay | pwtdly |
| ||||||||||||||||||||
W | pwtvsz | W and H would be provided in pwtvsz or sz in the format: WxH |
User parameters supported
oRTB User request parameter | Type | OW parameter |
---|---|---|
User.yob | integer | pwtyob |
User.Gender | string | pwtgender |
Content parameters supported
oRTB Content request parameter | Type | OW parameter | Parameter type |
---|---|---|---|
Content.Genre | string | pwtgenre | string |
Content.Title | string | pwttitle | string |
GDPR parameters supported
oRTB GDPR request parameter | Type | OW parameter | Notes |
---|---|---|---|
regs.ext.gdpr | Integer | pwtgdpr | Value indicating GDPR enabled or not |
user.ext.consent | string | pwtcnst | Consent string |
CCPA parameters supported
oRTB Content request parameter | Type | OW parameter | Notes |
---|---|---|---|
user.ext.us_privacy | string | pwtccpa | ccpa string |
Mobile parameters support
The following parameters would be considered only when "pwtapp" query parameter is set to 1 , which indicates this is a mobile request (i.e. &pwtapp=1)
oRTB Video request parameter | OW parameter | Parameter type | Notes |
---|---|---|---|
App.Id | pwtappid | String | |
App.Name | pwtappname | String | |
App.Bundle | pwtappbdl | String | |
App.Domain | pwtappdom | String | |
App.StoreURL | pwtappurl | String | |
App.Cat | pwtappcat | Array of String | |
App.Paid | pwtapppd | Integer | |
Device.Lmt | pwtlmt | Integer | Can be either 1 or 0 |
Device.Dnt | pwtdnt | Integer | Can be either 1 or 0 |
Device.JS | pwtjs | Integer | |
Device.Ifa | pwtifa | String | |
Device.DidSha1 | pwtdidsha1 | String | |
Device.DidMd5 | pwtdidmd5 | String | |
Device.DpidSha1 | pwtdpidsha1 | String | |
Device.DpidMd5 | pwtdpidmd5 | String | |
Device.MacSha1 | pwtmacsha1 | String | |
Device.MacMd5 | pwtmacmd5 | String | |
Device.Geo.Lat | pwtlat | Float | |
Device.Geo.Lon | pwtlon | Float | |
Device.Geo.Type | pwtgtype | Integer | |
Device.Geo.Country | pwtcntr | String | |
Device.Geo.City | pwtcity | String | |
Device.Geo.Metro | pwtmet | String | |
Device.Geo.Zip | pwtzip | String | |
Device.Geo.UtcOffset | pwtuto | Integer | |
User.ID | pwtuid | String |
Sample request
http://ow.pubmatic.com/openrtb/2.5/video/?v=1&pubId=5890&iuId=Div1&profId=4415& pwtvmxd=100&pwtvmnd=25&pwtmime=1&pwtplbk=1,2&pwtdly=-1&pwtm_description_url= www.abc.com&pwtm_sz=640x480&pwtbatr=1,26&owredirect=https%3A%2F%2F pubads.g.doubleclick.net%2Fgampad%2Fads%3Fiu%3D%2F15671365%2FVideohbHack %26description_url%3Dhttp%253A%252F%252Ftimesofindia.com%3Fpwtv%3D1%26env% 3Dvp%26impl%3Ds%26correlator%3D%26tfcd%3D0%26npa%3D0%26gdfp_req%3D1%26output %3Dvast%26sz%3D300x250%26max_ad_duration%3D%26url%3Dhttp%253A%252F% 252Ftimesofindia.com%26unviewed_position_start%3D1%26vpos%3Dpreroll% 26vad_type%3Dnar%26vpmute%3D1%26vpa%3D1
Macro Support
You can also send macros for GAM parameters as query parameters to the video endpoint. For example, sending pwtm_description_url=www.test.com would replace the description_url value in the GAM url, then use the same in constructing the oRTB Video object, and also update the GAM redirect URL with these values.
To send a macro for a given GAM parameter, use query parameter key, pwtm_<exact GAM parameter name>. For example,
http://ow.pubmatic.com/openrtb/2.5/video/?v=1&pwtm_description_url=www.abc.com ....
Debug Support
When a request is made to OpenWrap Video endpoint, it responds with a 302 redirect to the GAM URL. But sometimes, you may want to debug a particular request. You may enable debugging for an OpenWrap video request which would return a JSON response containing debug information. However, an important point to note here is: when debugging is enabled, the usual flow of redirection to GAM URL would NOT work and creative would not be rendered.
To enable debugging, you may follow these steps:
1. Use macro to set pwtm_url query parameter in the Video endpoint dynamically.
2. Add logic to always set page URL in pwtm_url macro before making a call to Video endpoint. This way any query parameters added to the page URL would be set in pwtm_url value.
3. When you want to enable debugging, add query parameter pwtvc=1 in the page URL. This would be replaced in the pwtm_url macro with the above logic and Video endpoint would respond with debug response.
Sample Video endpoint call with pwtm_url macro along with macros for a few other GAM parameters like sz, vpos, vtype:
http://ow.pubmatic.com/openrtb/2.5/video/?v=1&pubId=5890&profId=1294& pwtmime=1&owredirect=https://pubads.g.doubleclick.net/gampad/ads? correlator=19812761&iu=/15671365/MG_VideoAdUnit&env=vp&gdfp_req=1& output=vast&sz=640x480&description_url=http%3A%2F%2Fwww.test.com? pwtv=1&tfcd=0&npa=0&vpmute=0&vpa=0&vtype=linear&url=http%3A%2F%2F www.test.com&vpos=preroll&unviewed_position_start=1&pwtm_url=%%URL% %&pwtm_sz=%%SIZE%%&pwtm_vtype=%%VTYPE%%&pwtm_vpos=%%VPOS%%
Here is a sample code snippet that replaces pwtm_url macro dynamically with the page URL.
User Sync
Use this method to add a video ad to your page when you want to sync with a user cookie on the client side. The cookie will contain a list of bidders in JSON format passed from the URL query in the video ad iFrame:
<iframe title="User Sync" width=1 height=1 sandbox="allow-same-origin allow-scripts" frameborder="0" src="https://ads.pubmatic.com/AdServer/js/pwtSync/load-cookie.html?pubid=5890&profid=2652&bidders=appnexus,audienceNetwork,pubmatic,rubicon,pulsepoint,indexexchange,districtm"> <iframe>
Sample HTML
Your full page implementation might look something like this:
Limitations
OpenWrap for Video Ads does not currently support Companion Ads.