广告投放刷新率 [英] Ad delivery refresh rate

查看:53
本文介绍了广告投放刷新率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个页面,人们可以观看直播...我正尝试每隔十分钟通过OpenX更新一次广告横幅.

I have a page on my site where people watch live streams... I'm trying to update the advertising banners there through OpenX every ten minutes.

$('#ad_tag_top_left').html($('#ad_tag_top_left').html());

这没做...我想知道是否有人以前做过这项工作或有任何建议.我已经验证 $('#ad_tag_top_left').html()确实返回了以下代码...

This isn't doing the job... I'm wondering if anyone's done this before or has any suggestions. I've verified that $('#ad_tag_top_left').html() does indeed return the following code...

<!--//<![CDATA[
  document.MAX_ct0 ='INSERT_CLICKURL_HERE';

  var m3_u = (location.protocol=='https:'?'https://www.gamer-source.com/ad-server/www/delivery/ajs.php':'http://www.gamer-source.com/ad-server/www/delivery/ajs.php');
  var m3_r = Math.floor(Math.random()*99999999999);

  if (!document.MAX_used)
    document.MAX_used = ',';

  document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
  document.write ("?zoneid=62");
  document.write ('&amp;cb=' + m3_r);

  if (document.MAX_used != ',')
    document.write ("&amp;exclude=" + document.MAX_used);

  document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
  document.write ("&amp;loc=" + escape(window.location));

  if (document.referrer)
    document.write ("&amp;referer=" + escape(document.referrer));

  if (document.context)
    document.write ("&context=" + escape(document.context));

  if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {
    document.write ("&amp;ct0=" + escape(document.MAX_ct0));
  }

  if (document.mmm_fo) 
    document.write ("&amp;mmm_fo=1");

  document.write ("'><\/scr"+"ipt>");
//]]>-->

即使注释在HTML注释标签中,注释也会阻止它执行吗?

Could the comments be stopping it from executing even though it's within an HTML comment tag?

推荐答案

document.write (在上面的代码段及其引用的广告代码中都使用)仅在页面加载时有效,因此您的代码(无论如何都不能用于执行JavaScript).在您的情况下(,如果您无法重写脚本以完全使用jQuery),最好的解决方案是将广告代码放在iframe中:

document.write (used both in the above snippet and in the ad code referenced by it) will only work while the page is loading, so your code (which can't be used to execute JavaScript anyways) cannot work. The best solution in your case (i.e. if you cannot rewrite the script to use jQuery entirely) is to put the ad code inside an iframe:

<iframe
    src="ad_code.html"
    width="width of your banner"
    height="height of your banner"
    frameBorder="0"></iframe>

然后,将除广告代码之外的自动刷新代码放入 ad_code.html 文件中:

Then put this auto-refresh code inside the ad_code.html file in addition to the ad code:

<script>
setTimeout(function() {
    window.location.reload();
}, 600000);
</script>

希望,广告代码(如果点击了广告)将在iframe中而不是在包含窗口中打开赞助商的网页.

Hopefully, the ad code (if an ad is clicked on) will open the sponsor's web page not in the iframe but in the containing window.

这篇关于广告投放刷新率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆