1. Install MoPub SDK
Download and install the MoPub iOS SDK as described in the MoPub Wiki.
2. Create an app in MoPub Dashboard
If you already have created the app you will use in the MoPub Dashboard you can skip this section.
2. Create Placements in MoPub Dashboard
Create a new Ad Unit on the MoPub Dashboard. Select the ad format you want to display. For this example, we will select a 320x50 Banner Ad but PN Lite also supports 300x250 MRect Ads and Interstitial Ads.
Once it's created you'll get a confirmation that looks like the image below. Copy the Ad Unit ID they provide since you'll need it later to make ad requests.
3. Create Order and Line Items in MoPub Dashboard
The next step is creating an Order to set up the Line items
Create a new Order and use the name of the app as the Order name and Advertiser as well. This is not mandatory, just a good practice to avoid confusion.
After inserting the Order info, you need to create an initial Line Item. Set the type to Network and Priority to 12. This means the Line Item will compete with other ad networks and MoPub Marketplace.
Feel free to use any name for the Line Item but the recommended format is:
APP_NAME FORMAT ECPM OS
Here you can see an example:
DemoApp 320x50 0.01 iOS
In the network type choose Custom Native Network
In the class field add the full name of the PN Lite Adapter class you will use. There's one for each format. In this sample, we'll use the one for 320x50 Banner.
-
PNLiteMoPubBannerCustomEvent (320x50 Banner)
-
PNLiteMoPubMRectCustomEvent (300x250 MRect)
-
PNLiteMoPubInterstitialCustomEvent (Interstitial)
Finally, on the Data field, you need to specify which PubNative Ad Zone ID corresponds to this Line Item. This is needed so the adapter knows how to get the ad from the PN Lite SDK Ad Cache. Please add the following JSON to the field:
{"pn_zone_id": "AD_ZONE_ID"}
After this step, please define the eCPM of this line item:
After adding the eCPM, you need to assign the line item to an Ad unit. This will guarantee that this line item will compete in the waterfall when a request for this Ad unit is made:
Finally here comes the most important part:
We will use keywords to target our line item on the waterfall when competing with other networks on the same eCPM. In order to make this work, it's very important that when you make the request to MoPub from your app, you use the keywords generated by the PNLitePrebidUtils class from PN Lite.
The keywords are generated in the following format:
pn_bid:X.XXX
Basically, X.XXX being the eCPM received from the bid with up to 3 decimals after the point.
Samples:
eCPM: 1 USD Keyword: pn_bid:1.000
eCPM: 0.01 USD Keyword: pn_bid:0.010
eCPM: 0.3 USD Keyword: pn_bid:0.300
In the ideal situation, there should be a Line item for every possible eCPM in that range but this will end up in thousands of line items, therefore it is better recommended to group the eCPMs in ranges, usually bigger for smaller payouts and smaller for larger payouts. For example:
A line item with eCPM 0.01 can include:
pn_bid:0.010
pn_bid:0.011
pn_bid:0.012
pn_bid:0.013
pn_bid:0.014
pn_bid:0.015
pn_bid:0.016
pn_bid:0.017
pn_bid:0.018
pn_bid:0.019
Then the one with 0.02 can do the same up to the 0.029
For bigger eCPM Line Items it is recommended to have more granularity in the keywords to improve the matching on the waterfall.
< - Setup Pubnative Lite
-
Banner Ads