Desperately need a solution for Adsense that works with Ajax

前端 未结 6 439
醉话见心
醉话见心 2020-12-15 04:34

I know this questions has been asked a few times here. But these seem fairly outdated, and it looks like the Adsense for Ajax project has been canned (or at the very least,

6条回答
  •  醉酒成梦
    2020-12-15 05:19

    This is old but I figure an updated answer could be handy.

    Google's ad manager DFP does now support refreshing ads, which is something ajax sites could find useful. Unfortunately, they don't support moving ads, and you can only have each 'slot' used once per page refresh, so it's still pretty limited.

    tag=googletag.defineSlot('/1/my_ad', [728, 90], 'ad_0').addService(googletag.pubads())
    

    then later:

    googletag.pubads().refresh([tag]);
    

    If refreshing the same ad won't work for you, the best/only solution currently seems to be to make a simple iframe.html file with the google ad code and load that in an iframe dynamically via ajax with height and width set. I think Adsense is still smart enough to figure out the referring page in terms of contextual advertising.

提交回复
热议问题