2

this should be easy, adding another object in the units array. But when I do, I get an error, as the API can not find the container with the given ID. Screenshot of the Firebug console.

I have 3 units and the unit IDs are properly given and associated with containers. window.Mopub gets initialized and populated, it's and array of three objects, here's a screenshot of DOM - window.Mopub :

Integration code:

<script type="text/javascript">
  window.mopub = [{
    ad_unit: "2acca42ca4e746689c1d41cd1d5587e7",
    ad_container_id: "mopub_top", // 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
  }, {
    ad_unit: "c3eb9222c0fb459997b2ab3bfb4bde0d",
    ad_container_id: "mopub_mid", // 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
  }, {
    ad_unit: "a2a35dc504334ccd8e244076a4ee7518",
    ad_container_id: "mopub_floater", // Specify the div or container to which you’d like to the mobile web tag
    ad_width: 1,
    ad_height: 1,
    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>

The application is a classic mobile HTML5 website.

Am I missing something here?

  • Hi, @Alex did you find a way around this problem. If so, please let me know I am also stuck in this situation. – user4936092 Jun 10 '16 at 6:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.