{"_id":"5a710827650ebb001288647a","project":"5429beef1163360800ed31fa","version":{"_id":"5429beef1163360800ed31fd","__v":22,"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","5a3718305c66a60012d960ba"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5603738d0c78b00d0039af47","project":"5429beef1163360800ed31fa","pages":["561311eb41a9ec0d00a3fdf8","56958542cb14e11700f8a86e","56ad90e50c1cab0d009f658b"],"version":"5429beef1163360800ed31fd","__v":3,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-24T03:52:45.801Z","from_sync":false,"order":5,"slug":"exchange","title":"Marketplace"},"user":"569d8ad30306a10d00ce9a1f","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-01-31T00:04:55.846Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":14,"body":"Configure a 3rd Party Network tag campaign in Mopub. Use the below Polymorph tag to setup a creative under the 3rd Party Network tag campaign. This tag will fetch and render an Ad from Polymorph exchange, in case of no-fill the tag will signal Mopub accordingly so the Mopub SDK will waterfall to other partners down the line.\n\nYou just need to replace [PLACEMENT_ID] with your actual placement ID created on Polymorph. Placement ID can be fetched from Polymorph UI as shown here : https://dev.getpolymorph.com/docs/publisher-faqs#4-how-to-get-placement-id-\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!DOCTYPE html>\\n<html>\\n  <head></head>\\n  <body style=\\\"background-color: black;\\\">\\n    \\n    \\n    \\n    \\n    \\n    <!-- COPY FROM HERE - Polymorph : JS Tag START -->\\n\\n    <script type=\\\"text/javascript\\\">\\n      if(typeof trackImpressionHelper !== 'undefined') {\\n        var trackImpressionHelperResume = trackImpressionHelper;\\n        trackImpressionHelper = null;\\n      }\\n      mopubFinishLoad = null;\\n      // Polymorph to signal finishload to mopub \\n      function loadSuccess() {\\n        setTimeout(function() {\\n          if(typeof mopubFinishLoad == 'function') { mopubFinishLoad(); }\\n          window.location = 'mopub://finishLoad'\\n        }, 0);\\n        if(typeof trackImpressionHelperResume == 'function') trackImpressionHelperResume();\\n      }\\n      // If polymorph tag is delayed more than 1.5 seconds, track failLoad in mopub\\n      setTimeout(function() {\\n        if(!window.adFilled) window.location = 'mopub://failLoad';\\n      }, 1500);\\n    </script>\\n    <script type='text/javascript' src='//static.adsnative.com/static/js/pm-cm.js'></script>\\n    <script type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\\n    <script>\\n      var adsnativetag = adsnativetag || {};\\n      adsnativetag.cmdQ = adsnativetag.cmdQ || [];\\n      adsnativetag.cmdQ.push(function(){\\n        // Create ad unit\\n        window.dynamicAdUnit = adsnativetag.defineAdUnit({\\n          apiKey: '<REPLACE_POLYMORPH_PLACEMENT_ID>', // https://dev.getpolymorph.com/docs/publisher-faqs#4-how-to-get-placement-id-\\n          uuid: '%eudid!',                \\t\\t// User Device ID : Required if tag loaded in-app\\n          lat: '%%LATITUDE%%',            \\t\\t// Latitude : Optional\\n          long: '%%LONGITUDE%%',          \\t\\t// Longitude : Optional\\n          app: true,                      \\t\\t// Enable App Flag : Required if tag loaded in-app\\n          bundle_id: '%%BUNDLE%%',\\t\\t\\t\\t\\t\\t// App Bundle ID\\n          app_id: '%%PLACEMENTID%%',\\t\\t\\t\\t\\t// App ID\\n          app_name: '<REPLACE_YOUR_APP_NAME>'\\t// Replace with your App name  \\n        });\\n\\n        // Fetch ads\\n        adsnativetag.requestAds(function(status) {\\n          // Mopub passback\\n          if(!status) {\\n            loaded=true;\\n            window.location = \\\"mopub://failLoad\\\";\\n          }\\n        });\\n      });\\n    </script>\\n    <div id='dynamic-ad-slot'>\\n        <script type='text/javascript'>\\n          // Render ad\\n          adsnativetag.cmdQ.push(function() {\\n            adsnativetag.displayAdUnit(dynamicAdUnit, 'dynamic-ad-slot', function(adData) {\\n              window.Polymorph.initAdUnit('medrec', adData);\\n              window.adFilled = true;\\n              if(typeof loadSuccess == 'function') loadSuccess();\\n            });\\n          });\\n        </script>\\n    </div>\\n    \\n    <!-- COPY TILL HERE - Polymorph : JS Tag END -->\\n    \\n    <!-- Make sure you have replaced <POLYMORPH_PLACEMENT_ID> and <YOUR_APP_NAME> with your own values before setting it up in Mopub -->\\n    \\n    \\n    \\n    \\n    \\n  </body>\\n</html>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"polymorph-js-network-tag-setup-in-mopub","type":"basic","title":"Setup Polymorph JS Network Tag in Mopub"}

Setup Polymorph JS Network Tag in Mopub


Configure a 3rd Party Network tag campaign in Mopub. Use the below Polymorph tag to setup a creative under the 3rd Party Network tag campaign. This tag will fetch and render an Ad from Polymorph exchange, in case of no-fill the tag will signal Mopub accordingly so the Mopub SDK will waterfall to other partners down the line. You just need to replace [PLACEMENT_ID] with your actual placement ID created on Polymorph. Placement ID can be fetched from Polymorph UI as shown here : https://dev.getpolymorph.com/docs/publisher-faqs#4-how-to-get-placement-id- [block:code] { "codes": [ { "code": "<!DOCTYPE html>\n<html>\n <head></head>\n <body style=\"background-color: black;\">\n \n \n \n \n \n <!-- COPY FROM HERE - Polymorph : JS Tag START -->\n\n <script type=\"text/javascript\">\n if(typeof trackImpressionHelper !== 'undefined') {\n var trackImpressionHelperResume = trackImpressionHelper;\n trackImpressionHelper = null;\n }\n mopubFinishLoad = null;\n // Polymorph to signal finishload to mopub \n function loadSuccess() {\n setTimeout(function() {\n if(typeof mopubFinishLoad == 'function') { mopubFinishLoad(); }\n window.location = 'mopub://finishLoad'\n }, 0);\n if(typeof trackImpressionHelperResume == 'function') trackImpressionHelperResume();\n }\n // If polymorph tag is delayed more than 1.5 seconds, track failLoad in mopub\n setTimeout(function() {\n if(!window.adFilled) window.location = 'mopub://failLoad';\n }, 1500);\n </script>\n <script type='text/javascript' src='//static.adsnative.com/static/js/pm-cm.js'></script>\n <script type='text/javascript' src='//static.adsnative.com/static/js/render.v2.js'></script>\n <script>\n var adsnativetag = adsnativetag || {};\n adsnativetag.cmdQ = adsnativetag.cmdQ || [];\n adsnativetag.cmdQ.push(function(){\n // Create ad unit\n window.dynamicAdUnit = adsnativetag.defineAdUnit({\n apiKey: '<REPLACE_POLYMORPH_PLACEMENT_ID>', // https://dev.getpolymorph.com/docs/publisher-faqs#4-how-to-get-placement-id-\n uuid: '%eudid!', \t\t// User Device ID : Required if tag loaded in-app\n lat: '%%LATITUDE%%', \t\t// Latitude : Optional\n long: '%%LONGITUDE%%', \t\t// Longitude : Optional\n app: true, \t\t// Enable App Flag : Required if tag loaded in-app\n bundle_id: '%%BUNDLE%%',\t\t\t\t\t\t// App Bundle ID\n app_id: '%%PLACEMENTID%%',\t\t\t\t\t// App ID\n app_name: '<REPLACE_YOUR_APP_NAME>'\t// Replace with your App name \n });\n\n // Fetch ads\n adsnativetag.requestAds(function(status) {\n // Mopub passback\n if(!status) {\n loaded=true;\n window.location = \"mopub://failLoad\";\n }\n });\n });\n </script>\n <div id='dynamic-ad-slot'>\n <script type='text/javascript'>\n // Render ad\n adsnativetag.cmdQ.push(function() {\n adsnativetag.displayAdUnit(dynamicAdUnit, 'dynamic-ad-slot', function(adData) {\n window.Polymorph.initAdUnit('medrec', adData);\n window.adFilled = true;\n if(typeof loadSuccess == 'function') loadSuccess();\n });\n });\n </script>\n </div>\n \n <!-- COPY TILL HERE - Polymorph : JS Tag END -->\n \n <!-- Make sure you have replaced <POLYMORPH_PLACEMENT_ID> and <YOUR_APP_NAME> with your own values before setting it up in Mopub -->\n \n \n \n \n \n </body>\n</html>", "language": "html" } ] } [/block]