Refresh DFP ads

2019-09-14 17:33发布

问题:

I have a static chat page with Google DFP ads around it.

Is there a way to get those ads automaticly refresh every 5 minutes or so? I just want to refresh the ads, not the whole page.

I know that Google offers some tags like googletag.pubads().refresh(); but im not sure if i can use them for this purpose.

Thank you

回答1:

Check here it is feirly simple: https://support.google.com/dfp_premium/answer/2694377?hl=en&ref_topic=28788



回答2:

Yeah just set an interval of 300000 and use the refresh method like you mentioned. Technically I think it may be against the terms of service to refresh the ads on a timer without user interaction... but I'm not 100% on that and you would need to research the terms a bit more on the DFP site.



回答3:

This code should help:

<html>
<head>
  ...
</head>
<body>
  ...
      <!-- PUT THESE LINES ON THE FOOT OF YOUR PAGE -->
<script type="text/javascript">
   setInterval(function(){googletag.pubads().refresh();}, 300000);});  
</script>