Install MoPub SDK

Download and install the MoPub iOS SDK as described in the MoPub Wiki.

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.

Create a new iOS app on the MoPub Dashboard.

880

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 HyBid also supports 300x250 MRect Ads, 728x90 Leaderboard Ads and Interstitial Ads

875

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.

648

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.

1069

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 HyBid Adapter class you will use. There's one for each format. In this sample, we'll use the one for 320x50 Banner.

  • HyBidMoPubHeaderBiddingLeaderboardCustomEvent (728x90 Leaderboard)
  • HyBidMoPubHeaderBiddingBannerCustomEvent (320x50 Banner)
  • HyBidMoPubHeaderBiddingMRectCustomEvent (300x250 MRect)
  • HyBidMoPubHeaderBiddingInterstitialCustomEvent (Interstitial)
  • HyBidMoPubHeaderBiddingRewardedCustomEvent (Rewarded)

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 HyBid SDK Ad Cache. Please add the following JSON to the field:

{"pn_zone_id": "AD_ZONE_ID"}

2056

After this step, please define the eCPM of this line item:

1109

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:

1000

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 HyBidHeaderBiddingUtils class from HyBid.

The keywords are generated with the following format:

pn_bid:X.XX

Basically, X.XX being the eCPM received from the bid with up to 2 decimals after the comma.

Samples:

eCPM: 1 USD Keyword: pn_bid:1.00

eCPM: 0.01 USD Keyword: pn_bid:0.01

eCPM: 0.3 USD Keyword: pn_bid:0.30

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.10 can include:

pn_bid:0.11

pn_bid:0.12

pn_bid:0.13

pn_bid:0.14

pn_bid:0.15

pn_bid:0.16

pn_bid:0.17

pn_bid:0.18

pn_bid:0.19

Then the one with 0.20 can do the same up to the 0.29

For bigger eCPM Line Items it is recommended to have more granularity in the keywords to improve the matching on the waterfall.

1078

Return to the MoPub Header Bidding