16 thoughts on “How To Add Admob To Your jQuery Mobile App

  1. Awesomely easy!! thank you!!

    BTW.. what’s the iPhone simulator you’re running? Might it be available for the mac?

    1. Yes it is available on the mac. It’s actually xcode’s simulator from developer.apple.com. Let me know if I can help in any way!

      Thanks,

  2. Hi, I’ve been succesful at adding AdMob ads on my front page (Go to my homepage with a smartphone and it will redirect you). However, if I add the AdMob ads on a second page it doesn’t show anymore. I think it’s due to the Ajax of jQuery Mobile. AdMob has some tip that may work, but I was not able to make it work (See: iUI section: http://developer.admob.com/wiki/IPhone). Anyways, have you guys figured out how to integrate AdMob ads on all pages of a jQuery Mobile App? I’m trying to place them in the persistent footer. Thanks!

  3. Nick is right. The technique on your video does not work for jQuery Mobile. You need to either take this video down or redo it.

    To make admob work, you need to use Admob’s manual mode and invoke the ad rendering on each pageshow event.

    Here is what I used to make it work…

    var admob_vars = {
    pubid: ‘xxx’,
    bgcolor: ‘FF9119’,
    text: ‘FFFFFF’,
    ama: false,
    test: false,
    manual_mode: true
    };

    var fnFoo = function(){
    var ad = $(‘#admob_ad’,this)[0];
    if (typeof ad != ‘undefined’) {
    ad.innerHTML = ”;
    _admob.fetchAd(ad);
    }
    $(‘div[data-role=page]’).die(‘pageshow’, fnFoo);
    };
    $(‘div[data-role=page]’).live(‘pageshow’, fnFoo);

    1. Re: my previous post — it looks like the comment system stripped out all the html tags. There’s a div tag at the beginning, a script tag around the var admob_vars, the iadmob.js src next, then a final script tag around the fnFoo function and pageshow calls

      1. Pete,

        thanks for the tip. It seems promising, but it doesn’t quite work right. It breaks the layout of my app when using the back button. I went to your mobile site to get the correct code. It also breaks the layout of your app if you click on “About” and then hit the back button.

        Nick,

        1. Hello evrybody i have the same problem,this method does not work,
          Anyone have the solution to add some AdMob pub into our jquerymobile website?

          1. Have you tried the solution provided above? I plan on implementing it and re-doing this screen cast in the coming week.

  4. Hello i want to know the api available in admob how i can use that api in my php site and also i generated the script using smartphone web and put that code in my php file but i am can’t see the output

Leave a Reply

Your email address will not be published. Required fields are marked *