{"_id":"597e051217748e0015e7e255","project":"5429beef1163360800ed31fa","version":{"_id":"5429beef1163360800ed31fd","__v":21,"project":"5429beef1163360800ed31fa","createdAt":"2014-09-29T20:19:59.904Z","releaseDate":"2014-09-29T20:19:59.904Z","categories":["5429beef1163360800ed31fe","55e74e1f5d36b32b002563fa","55e7500a73169617001f2e86","55e76b8196131b2f00bf4b72","55e89569cdbb8a350096df9c","55f8935eb089b71700a8364e","55f8a67d3bb4bb0d0022d093","55f9dbefc7ef770d00d9bf6d","5601c21a22ecf60d002b27b3","5601c21ff12aee0d001bb06e","5601c2256c7b610d00280db5","5601c22c22ecf60d002b27b4","5603738d0c78b00d0039af47","5626f70bfcbbc621004ebf52","566f7a1ae144ab0d00e9732f","566f85ca7820960d00c3b93d","56708ce43a32d20d00c45cbf","56708d436995210d003aad8e","5736471abe10a9200030732c","57a82c7aff9bd30e00a6f1c1","591b8500e3992319007190f4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5601c22c22ecf60d002b27b4","pages":["5601d37b70694e0d00e3c67e","5601d3a0d3ffde0d006abbd0","5601d3fd96e0f70d0044b110","5601d42096e0f70d0044b112","5601d45d7435de0d00fabc27","5601d48170694e0d00e3c680","561c925fac06982100493d19","56606f35bb77350d0073249b","567090d51dabd80d00b122ca","56abc1004e8ba20d006a23c9"],"version":"5429beef1163360800ed31fd","__v":10,"project":"5429beef1163360800ed31fa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-22T21:03:40.067Z","from_sync":false,"order":7,"slug":"demand-manager","title":"Demand Manager"},"user":"563b4a20dfa1282b000dd262","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-07-30T16:10:58.528Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"Polymorph allows mobile app publishers to plug into Polymorph demand via MoPub mediation. But, this does not guarantee the best price for your impressions as header bidding is not possible for mobile apps.\n\nHowever, Polymorph has developed a way to bring header bidding for mobile app inventory through our client-server bidding mechanism which can be setup on top of MoPub. This document explains in detail how to achieve this.\n\n<i>Note: The support is currently available only for Android. We will add the support for iOS soon </i>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Setup Polymorph on MoPub\"\n}\n[/block]\nBefore you start integrating our client-server bidding mechanism, you must setup Polymorph as a Network on MoPub, as explained in this [documentation](doc:mediating-polymorph-on-mopub)\n[block:api-header]\n{\n  \"title\": \"2. Integrate Polymorph's Client-Server Bidder\"\n}\n[/block]\nAfter you have setup Polymorph as a network on MoPub, you can integrate our client-server bidder as explained below.\n\na. Initialise MoPubNative class as you would normally do while integrating with MoPub SDK\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"MoPubNative moPubNative = new MoPubNative(this.getContext(), MOPUB_AD_UNIT_ID, moPubNativeListener);\\n... // create MoPub's ViewBinder\\n... // register MoPub's AdRenderer\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nb. Initialise Polymorph bidder preferably in your main or parent activity class <code>onCreateView()</code> method\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PolymorphBidder polymorphBidder = new PolymorphBidder(this.getContext());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nb. Call MoPub ads via Polymorph bidder which will automatically handle header bidding while also pre-fetching ads from Polymorph to avoid network latency. DO NOT invoke <code>mopubNative.makeRequest()</code> as this is internally handled by PolymorphBidder.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"polymorphBidder.loadMopubAd(POLYMORPH_AD_UNIT_ID, moPubNative);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n<b><i>Please note that you need to pass Polymorph ad unit id while making the above call, else header bidding will fail.</i></b>\n\nVoila ! You have successfully integrated our client-server header bidding via MoPub. Now, all you have to do is create line items on MoPub dashboard with various ecpm floor values (as shown in the section below) to ensure MoPub is fetching the highest paying ad for each of your impressions.\n[block:api-header]\n{\n  \"title\": \"3. Create Line Items on MoPub\"\n}\n[/block]\nYou can create as many line items as you would like for various ecpm ranges. We recommend you to create line items for every 1 cent, between the range of your expected ecpm values of your inventory. For example, if you believe your inventory is valued between $0.5 to $1.0 then we recommend you to setup line items, one with each of the following as the ecpm floors.\n\nLine Item 1: $0.50 as floor\nLine Item 2: $0.51 as floor\nLine Item 3: $0.52 as floor\nLine Item 4: $0.53 as floor\n....\nand so on upto $1.0\n\nPlease note that this is just a recommendation. You can create line items for every 5 cents or every 10 cents or any interval of your choice. But keeping it granular to 1 cent maximises the effectiveness of the header-bidding.\n\n<b>Enabling Keywords Targeting</b>\nOnce you have created line items with various ecpm floors, you need to enable keywords targeting. This step is extremely important to ensure that our client-server bidder is able to invoke the correct line item based on the ecpm. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f9ba316-Screen_Shot_2017-07-30_at_10.26.22_PM.png\",\n        \"Screen Shot 2017-07-30 at 10.26.22 PM.png\",\n        1930,\n        512,\n        \"#364853\"\n      ]\n    }\n  ]\n}\n[/block]\n<b><i>Please note that the ecpm value you enter in the keywords targeting is same as the ecpm floor of that particular line item.</i></b>","excerpt":"","slug":"client-server-header-bidding-via-mopub","type":"basic","title":"Client-Server Header Bidding via MoPub"}

Client-Server Header Bidding via MoPub


Polymorph allows mobile app publishers to plug into Polymorph demand via MoPub mediation. But, this does not guarantee the best price for your impressions as header bidding is not possible for mobile apps. However, Polymorph has developed a way to bring header bidding for mobile app inventory through our client-server bidding mechanism which can be setup on top of MoPub. This document explains in detail how to achieve this. <i>Note: The support is currently available only for Android. We will add the support for iOS soon </i> [block:api-header] { "type": "basic", "title": "1. Setup Polymorph on MoPub" } [/block] Before you start integrating our client-server bidding mechanism, you must setup Polymorph as a Network on MoPub, as explained in this [documentation](doc:mediating-polymorph-on-mopub) [block:api-header] { "title": "2. Integrate Polymorph's Client-Server Bidder" } [/block] After you have setup Polymorph as a network on MoPub, you can integrate our client-server bidder as explained below. a. Initialise MoPubNative class as you would normally do while integrating with MoPub SDK [block:code] { "codes": [ { "code": "MoPubNative moPubNative = new MoPubNative(this.getContext(), MOPUB_AD_UNIT_ID, moPubNativeListener);\n... // create MoPub's ViewBinder\n... // register MoPub's AdRenderer", "language": "java" } ] } [/block] b. Initialise Polymorph bidder preferably in your main or parent activity class <code>onCreateView()</code> method [block:code] { "codes": [ { "code": "PolymorphBidder polymorphBidder = new PolymorphBidder(this.getContext());", "language": "java" } ] } [/block] b. Call MoPub ads via Polymorph bidder which will automatically handle header bidding while also pre-fetching ads from Polymorph to avoid network latency. DO NOT invoke <code>mopubNative.makeRequest()</code> as this is internally handled by PolymorphBidder. [block:code] { "codes": [ { "code": "polymorphBidder.loadMopubAd(POLYMORPH_AD_UNIT_ID, moPubNative);", "language": "java" } ] } [/block] <b><i>Please note that you need to pass Polymorph ad unit id while making the above call, else header bidding will fail.</i></b> Voila ! You have successfully integrated our client-server header bidding via MoPub. Now, all you have to do is create line items on MoPub dashboard with various ecpm floor values (as shown in the section below) to ensure MoPub is fetching the highest paying ad for each of your impressions. [block:api-header] { "title": "3. Create Line Items on MoPub" } [/block] You can create as many line items as you would like for various ecpm ranges. We recommend you to create line items for every 1 cent, between the range of your expected ecpm values of your inventory. For example, if you believe your inventory is valued between $0.5 to $1.0 then we recommend you to setup line items, one with each of the following as the ecpm floors. Line Item 1: $0.50 as floor Line Item 2: $0.51 as floor Line Item 3: $0.52 as floor Line Item 4: $0.53 as floor .... and so on upto $1.0 Please note that this is just a recommendation. You can create line items for every 5 cents or every 10 cents or any interval of your choice. But keeping it granular to 1 cent maximises the effectiveness of the header-bidding. <b>Enabling Keywords Targeting</b> Once you have created line items with various ecpm floors, you need to enable keywords targeting. This step is extremely important to ensure that our client-server bidder is able to invoke the correct line item based on the ecpm. [block:image] { "images": [ { "image": [ "https://files.readme.io/f9ba316-Screen_Shot_2017-07-30_at_10.26.22_PM.png", "Screen Shot 2017-07-30 at 10.26.22 PM.png", 1930, 512, "#364853" ] } ] } [/block] <b><i>Please note that the ecpm value you enter in the keywords targeting is same as the ecpm floor of that particular line item.</i></b>