I’m trying to put some ads on my site and would like to load them after the page has loaded. We’re using Doubleclick DART (please, don’t tell me to use Google AdSense. I know, but that’s a battle for another day). Doubleclick currently recommends embedding inline script tags like so:
<script language=Javascript1.1 src="http://ad.doubleclick.net/adj/sitename.dart/
zonename;abr=!webtv;kw=value;sz=widthxheight;ord=value">
</script>
This returns a document.write with the ad html.
Does anyone know of a way to request the ads with an AJAX call so that only HTML is returned, thus allowing me to place the ads at my discretion? I’ve seen this done for mobile ads, but haven’t found anything for websites yet.
I eventually resolved this using a script called writeCapture. It intercepts the document.write event on ads and lets you perform the HTML append.
The documentation on the site is great, and you can see it in action on The Daily Beast.