Domanda

According to inmobi Developer Wiki

http://developer.inmobi.com/wiki/index.php?title=JavaScript

You can call the Ads on Demand using manual: true parameter in the Var section:

E.g:

<script type="text/javascript" src="http://cf.cdn.inmobi.com/ad/inmobi.js">
    </script>   

<script type="text/javascript">
  var inmobi_conf = {
    siteid : "your site id",
    slot : "slot number",
    test: true,
    manual: true
  };
</script>


<div id="adArea"> </div>

To generate the Ad you have to call it using:

_inmobi.getNewAd(document.getElementById('adArea'));

it should populate the Ad.

I´ve created a simple test example to request an Ad on demand (using test siteid provided by inmobi).

The problem is that I have to click twice to load the Ad

Full Source:

<html>
  <head>
   <script>
     var inmobi_conf = {
       siteid : "4028cba631d63df10131e1d3191d00cb",
       slot : "15",
       test: true,
       manual: true
     };

     function loadAdd(){
       _inmobi.getNewAd(document.getElementById('screen'));
   };
   </script>
   <script src="http://cf.cdn.inmobi.com/ad/inmobi.js"></script>        
  </head>
    <body>
      <div id="screen"> </div>
        <button id="btn1" onClick="loadAdd()">Load Ad</button>
    </body>
</html>  

You can try it out on http://jsfiddle.net/YYzqA/

1st click on "Load Ad" button (no Ad)

2nd click on "Load Ab" button (the Ad will be loaded)

By chance do you know the reasons for this behavior? am I missing something?

È stato utile?

Soluzione

You have set manual: true

you need to set it to manual: false for it to automatically set the configuration for you.

When you set manual: true, your first click is loading the configurations

Checkout the fiddle

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top