0
Google even does this, but I don’t understand the googletag part.Defineslots, I don’t know where you get this number. Google example:
<script>
// Load GPT asynchronously
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement("script");
gads.async = true;
gads.type = "text/javascript";
var useSSL = "https:" == document.location.protocol;
gads.src = (useSSL ? "https:" : "http:") +
"//www.googletagservices.com/tag/js/gpt.js";
var node = document.getElementsByTagName("script")[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
<script>
googletag.cmd.push(function() {
// Define the ad slot
var slot1 = googletag.defineSlot("/6355419/Travel", [728, 90], "leaderboard").
setTargeting("test", "refresh").
addService(googletag.pubads());
// Start ad fetching
googletag.enableServices();
googletag.display("leaderboard");
// Set timer to refresh slot every 30 seconds
setInterval(function(){googletag.pubads().refresh([slot1]);}, 30000);
});
</script>
Page link: https://support.google.com/dfp_premium/answer/2694377?hl=pt-BR
– Gerson Valdeir
Can make a script to update the div as well
– Gerson Valdeir