GAM Ad Server Configuration (for OpenWrap and in-app SDK)

Trafficking Wrapper Line Items 

This step is required so the ad server, based on actual bid price, can allocate impressions to the winning partner. These bids are passed using key-value pairs added to the ad server tags dynamically, as explained in the previous sections.

The preferred option is for the PubMatic solution engineering team to support the order creation in GAM. You must provide trafficker-level access. PubMatic's order insertion tool can be used to insert the relevant order into GAM and create granular line items.

Step 1

Create a new order in GAM for a Wrapper as PubMatic/PubMatic-Wrapper as the advertiser and add the relevant details.

Step 2

Set the price and priority of the line items.  

Step 3

Set targeting on the pwtbst value as 1 from the. In addition to pwtbst, you will also need to set targeting on pwtecp.  For more information, please refer to the Best Practices to Create Line Items section below.

For OpenWrap:

For OpenWrap SDK:

Step 4

Add the Wrapper creative provided by PubMatic to the line item you created.  

OpenWrap - Display - Non-SafeFrame
<script type='text/javascript'> var i = 0, w = window.self; while(w!== && 
!(w.PWT && w.PWT.displayCreative) && i<10){ w = window.self.parent; i++; } 
try{ w.PWT.displayCreative(document, '%%PATTERN:pwtsid%%'); } catch(e){} </script>


OpenWrap - Display - SafeFrame
<script src='//
pwtprofid%%/%%PATTERN:pwtverid%%/pwt.js'></script><script type='text/javascript'>
OpenWrap - AMP
<script src='//
,pwtpid:'%%PATTERN:pwtpid%%' })</script>
OpenWrap/OpenWrap SDK - InApp
<script type="text/javascript" src=""></script>
<script type="text/javascript">"pubmaticdm", "%%PATTERN:pwtsid_partnername%%");


If you plan to copy/paste the OpenWrap SDK - InApp sample above into your own wrapper, you must replace the partnername placeholder with the name of an actual PubMatic partner.

Best Practices for Creating Line Items

If GAM is the ad server, ensure the line items do NOT have Google safe frame setting enabled. After June 27th, 2016, line items are automatically created in GAM with safe frame enabled by default. This setting will cause the creative to appear as blank. This requires that users manually uncheck "safe frame," regardless of whether it was manually or automatically enabled.

To control monetization through Wrapper Solution at a granular level, you may:

  • Create multiple line items in the ad server for each ad unit/ad size/CPM range/geo.
  • Use pwtecp as the targeting attribute.
  • Place the line items at different priorities based on the desired configuration.

While creating line items at multiple price points, we recommend you create line items with more granular pricing where the bid density is high.

If 80% of the bids are between $0 to $3, create line items at a $0.1 granularity. For other ranges you can create line items at a coarse granularity.

Please see more details below.

30 line items between $0-$3 with rate increment of $0.1 
LineItem 1 (covers $0-$0.09) Targeting: pwtecp=0.01*,pwtecp=0.02*....,pwtecp=0.09*, rate=$0.05 
LineItem 2 (covers $0.10-$0.19) Targeting: pwtecp=0.1*, rate=$0.15 
and so on for next 28 line items

15 Line items between $3-$8 with rate increment of $0.30 
LineItem 31 (covers $3.0-$3.29) Targeting: pwtecp=3.0*,pwtecp=3.1*,pwtecp=3.2*, rate=$3.15 
LineItem 32 (covers $3.30-$3.59) Targeting: pwtecp=3.3*,pwtecp=3.4*,pwtecp=3.5*, rate=$3.45 
and so on for next 13 line items

12 Line items between $9-$20 with rate increment of $1.0 
LineItem 46 (covers $9.0-$9.99) Targeting: pwtecp=9.*, rate=$9.5 
LineItem 47 (covers $10.0-$10.99) Targeting: pwtecp=10.*, rate=$10.5 
and so on for next 10 line items

A final high- priority line item for very high bids
Line Item 58 (Covers $20 and above) Targeting : pwtecp=20*,pwtecp=21*,pwtecp=22*...... pwtecp=50*) rate= $21

⇧ Top

Do you have feedback on this document? Let us know: email us.

Table of Contents