{"_id":"59d44e3cf8693e003c9624b8","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":"56f305ac92cce10e00eaf0d9","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-10-04T02:58:04.529Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"Polymorph allows mobile app publishers to plug into Polymorph demand via DFP 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 DFP. 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\nBelow are the integration steps/stages:\n\n1. Adding Permissions to the Manifest file\n2. Creating a header bidding request\n3. Creating line items on DFP\n\n[block:api-header]\n{\n  \"title\": \"1. Adding Permissions to the Manifest file\"\n}\n[/block]\nDeclare the following security permissions in your manifest file (AndroidManifest.xml)\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Permission\",\n    \"h-1\": \"Description of Entry\",\n    \"0-0\": \"Internet\",\n    \"0-1\": \"Access the Internet. Required for ad-content download.\",\n    \"1-0\": \"WiFi State\",\n    \"1-1\": \"Access the WiFi state. Required for fetching ip address from WiFi Manager.\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"2. Creating a header bidding request\"\n}\n[/block]\nInitialise DFP class as you would normally do while integrating with DFP SDK\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"AdLoader adLoader = new AdLoader.Builder(context, DFP_AD_UNTI_ID)\\n    .forAppInstallAd(new OnAppInstallAdLoadedListener() {\\n        :::at:::Override\\n        public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {\\n            // Show the app install ad.\\n        }\\n    })\\n    .forContentAd(new OnContentAdLoadedListener() {\\n        @Override\\n        public void onContentAdLoaded(NativeContentAd contentAd) {\\n            // Show the content ad.\\n        }\\n    })\\n    .withAdListener(new AdListener() {\\n        @Override\\n        public void onAdFailedToLoad(int errorCode) {\\n            // Handle the failure by logging, altering the UI, etc.\\n        }\\n    })\\n    .withNativeAdOptions(new NativeAdOptions.Builder()\\n            // Methods in the NativeAdOptions.Builder class can be\\n            // used here to specify individual options settings.\\n            .build())\\n    .build();\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nInitialise 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]\nCall loadDFPAd ads via Polymorph bidder which will automatically handle header bidding while also pre-fetching ads from Polymorph to avoid network latency.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"polymorphBidder.loadDFPubAd(POLYMORPH_AD_UNIT_ID, adLoader);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"3. Creating Line Items on DFP\"\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**Create Key-value Targeting**\nOnce you have created line items with various ecpm floors, you need to create various ecpm key-values and target this to the line items. This step is extremely important to ensure that our client-server bidder is able to invoke the correct line item based on the ecpm. Refer https://support.google.com/dfp_premium/answer/188092?hl=en\n\n_Please note that the ecpm value you enter in the key-value targeting is same as the ecpm floor of that particular line item._","excerpt":"","slug":"client-server-header-bidding-via-dfp","type":"basic","title":"Client-Server Header Bidding via DFP"}

Client-Server Header Bidding via DFP


Polymorph allows mobile app publishers to plug into Polymorph demand via DFP 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 DFP. 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> Below are the integration steps/stages: 1. Adding Permissions to the Manifest file 2. Creating a header bidding request 3. Creating line items on DFP [block:api-header] { "title": "1. Adding Permissions to the Manifest file" } [/block] Declare the following security permissions in your manifest file (AndroidManifest.xml) [block:parameters] { "data": { "h-0": "Permission", "h-1": "Description of Entry", "0-0": "Internet", "0-1": "Access the Internet. Required for ad-content download.", "1-0": "WiFi State", "1-1": "Access the WiFi state. Required for fetching ip address from WiFi Manager." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "title": "2. Creating a header bidding request" } [/block] Initialise DFP class as you would normally do while integrating with DFP SDK [block:code] { "codes": [ { "code": "AdLoader adLoader = new AdLoader.Builder(context, DFP_AD_UNTI_ID)\n .forAppInstallAd(new OnAppInstallAdLoadedListener() {\n @Override\n public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {\n // Show the app install ad.\n }\n })\n .forContentAd(new OnContentAdLoadedListener() {\n @Override\n public void onContentAdLoaded(NativeContentAd contentAd) {\n // Show the content ad.\n }\n })\n .withAdListener(new AdListener() {\n @Override\n public void onAdFailedToLoad(int errorCode) {\n // Handle the failure by logging, altering the UI, etc.\n }\n })\n .withNativeAdOptions(new NativeAdOptions.Builder()\n // Methods in the NativeAdOptions.Builder class can be\n // used here to specify individual options settings.\n .build())\n .build();", "language": "java" } ] } [/block] 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] Call loadDFPAd ads via Polymorph bidder which will automatically handle header bidding while also pre-fetching ads from Polymorph to avoid network latency. [block:code] { "codes": [ { "code": "polymorphBidder.loadDFPubAd(POLYMORPH_AD_UNIT_ID, adLoader);", "language": "java" } ] } [/block] [block:api-header] { "title": "3. Creating Line Items on DFP" } [/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. **Create Key-value Targeting** Once you have created line items with various ecpm floors, you need to create various ecpm key-values and target this to the line items. This step is extremely important to ensure that our client-server bidder is able to invoke the correct line item based on the ecpm. Refer https://support.google.com/dfp_premium/answer/188092?hl=en _Please note that the ecpm value you enter in the key-value targeting is same as the ecpm floor of that particular line item._