Loading ads into the page via AJAX - jquery mobile

1,432 views
Skip to first unread message

Alain Richardt

unread,
Jan 3, 2012, 6:12:20 AM1/3/12
to google-doubleclick...@googlegroups.com
Hi there,

I'm currently writing an ajax heavy mobile web application, using jquery mobile. I want to serve ads into the mobile web app, but they *must* be pulled in via ajax, because the page only loads once, movements to other "pages" are done with ajax loading the HTML into the DOM then doing a "page" transition with CSS.

I have a minimum use-case example, that doesn't involve jquery mobile to make testing easier ... basically, I need this to work:

<!DOCTYPE html>

<html>

<head>

<script type='text/javascript'>

(function() {

var useSSL = 'https:' == document.location.protocol;

var src = (useSSL ? 'https:' : 'http:') +

'//www.googletagservices.com/tag/js/gpt_mobile.js';

document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');

})();

</script>

<script type='text/javascript'>

googletag.cmd.push(function() {

googletag.defineSlot('/6837/Mobile_Ad_Showcase/APP_DOWNLOAD', [320, 50], 'div-gpt-ad-1324321408096-0').addService(googletag.pubads());

googletag.enableServices();

});

function showAd()

{

googletag.cmd.push(function() { googletag.display('div-gpt-ad-1324321408096-0')});

}

</script>

</head>

<body>

<!-- Mobile_Ad_Showcase/APP_DOWNLOAD -->

<div id='div-gpt-ad-1324321408096-0'>

</div>

<input type="button" value="Show ad" onclick="showAd();" />

</body>

</html>

When I click on the button, and showAd() is called, I am attempting to load the ad into the DIV, but nothing happens. No javascript errors, googletag.cmd.push appears to do nothing.

Can I get some feedback on this please? Am I doing something wrong?

Thanks

Alain

DFP Advisor

unread,
Jan 3, 2012, 1:14:21 PM1/3/12
to google-doubleclick...@googlegroups.com
Hi Alain,

Unfortunately, this forum isn't the best place for this type of question. 


Thanks,
Adam Rogal, DFP API Team

Charlie Gorichanaz

unread,
Jul 27, 2012, 2:10:03 AM7/27/12
to google-doubleclick...@googlegroups.com
Have you found a solution? I am experiencing the same problem.

Nitesh Thakur

unread,
Feb 8, 2013, 8:14:33 AM2/8/13
to google-doubleclick...@googlegroups.com
Have you found a solution? I am experiencing the same problem, please....

Adam Rogal (DFP API Team)

unread,
Feb 8, 2013, 11:49:06 AM2/8/13
to google-doubleclick...@googlegroups.com
Hi Nitesh,

As mentioned earlier, please try your question at the DFP product forum:  https://groups.google.com/a/googleproductforums.com/forum/#!forum/dfp

Thanks,
Adam Rogal, DFP API Team

Reply all
Reply to author
Forward
0 new messages