MoPub supports a simple Javascript tag to integrate our ad serving technology into your mobile websites. Simply include the following tags, customized with your ad unit ID and creative size.
Paste the following code snippet into your mobile webpage where you’d like to see ads appear:
//Drop the below script in the head of your site
<script type="text/javascript">
window.mopub = [{
ad_unit: "5cb3315a772b4f5bb9bcc4e8464a8345",
ad_container_id: "YOUR_AD_CONTAINER", // Specify the div or container to which you’d like to the mobile web tag
ad_width: 320,
ad_height: 50,
keywords: "", // Optionally pass keywords as a comma separated list
} ]; // To load additional ad units, add another object into the array.
(function() {
var mopubjs = document.createElement("script");
mopubjs.async = true;
mopubjs.type = "text/javascript";
mopubjs.src = "//d1zg4cyg8u4pko.cloudfront.net/mweb/mobileweb.min.js";
var node = document.getElementsByTagName("script")[0];
node.parentNode.insertBefore(mopubjs, node);
})();
</script>
<div id="YOUR_AD_CONTAINER"></div>
Be sure to replace <> with the correct Ad Unit ID, for example agltb3B1Yi1pbmNyDAsSBFNpdGUY2fgDDA.