Is there an AJAX service for doubleclick (DART)

情到浓时终转凉″ 提交于 2019-12-03 08:32:22

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.

You should be able to replace "adj" (Ad JavaScript) with "adi" (Ad IFrame) in your script URL to get the HTML. After you make that change you can inject the script after page load by dynamically creating an iframe element, setting the source to the script URL and appending it to the DOM.

I wrote an extension using jQuery to inject DoubleClick ads into a page after page load. You can find it at jquery-doubleclick-ads - Google Code and it is currently in use on the www.ourbrisbane.com site.

you can also utilise /adx/ which tells doubleclick to return the ad in its original form (whether HTML / js tags etc) without wrapping it in document.write or an iframe.

But note google may not 'officially' support any issue this may cause but through experience there not many ways this can go wrong outside of your ad script

You can AJAX it in like so

<script type="text/javascript">
    var ord = Math.random();
    ord = ord*10000000000000000000;

    jQuery.ajax({
        url: "http://ad.doubleclick.net/adj/sitename/homepage;pos=1;ord='+ord+';sz=300x600,300x250,160x600",
        cache: false,
        dataType: "html",     
        success: function(html){
            $("#mysAd").append(html.split("'")[1]);
        }
    });
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!