Not signaling the end of the video
Google says that, for the post-roll to play, the SDK needs to know the content has ended. Without this notice, the end break does not happen.
Implementation guide
Post-roll video ads
A video ad that plays in the same player right after the video ends, like the commercials at the end of a TV show.
Understand it in 1 minute
You know when a TV show ends and, before the next one starts, a few commercials play? Post-roll is that on your site: a video ad that plays at the end of the video, inside the same player. The person has already watched what they wanted and the ad appears right after. Pre means before, mid means middle and post means after.
The secret of post-roll is telling the player that the video has ended. The IMA SDK, which is Google's code package for putting ads in the player, cannot guess on its own that the content has finished. Google's guide says it like this: for the post-roll to play, you need to tell the SDK when the content has ended, and then it plays the end break, if one is scheduled. This notice should only be sent when the video ends, never when an ad ends, because IMA may use the same player for the ads. It is like ringing the school bell only when the class ends, and not in the middle of recess.
Breaks can be organized by video ad rules, a Google Ad Manager 360 feature. In them, the post-roll can be turned on (Enable), turned off (Disable) or left for a lower-priority rule to decide (Defer). With rules, the answer comes in VMAP, which is like a TV schedule, saying which breaks exist. Without rules, the player itself can make the request at the end of the video and say in the tag that it is a post-roll.
When is it worth it? When you already have videos on the site and want one more moment for an ad that does not interrupt the start or middle of the content. The rules for any in-stream ad still apply: the space must be declared the right way, the controls cannot be hidden and only one visible autoplay player can play at a time. And, when all the breaks have played, IMA announces it with its own event, which you can use to tidy up the page.
Step by step
Implemented example
<script>
var video = document.getElementById('conteudo');
// Avisa o IMA que o CONTEÚDO acabou (nunca no fim de um anúncio)
var contentEndedListener = function () { adsLoader.contentComplete(); };
video.addEventListener('ended', contentEndedListener);
adsLoader.addEventListener(
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
function (e) {
adsManager = e.getAdsManager(video);
adsManager.addEventListener(
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
function () {
// anúncio vai tocar: tira o ouvinte de fim do vídeo
video.removeEventListener('ended', contentEndedListener);
video.pause();
});
adsManager.addEventListener(
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
function () {
// conteúdo volta: coloca o ouvinte de novo
video.addEventListener('ended', contentEndedListener);
if (!video.ended) { video.play(); }
});
adsManager.addEventListener(
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
function () { console.log('Todos os intervalos tocaram'); });
});
</script>What Google recommends
Tips
Watch out
Google says that, for the post-roll to play, the SDK needs to know the content has ended. Without this notice, the end break does not happen.
If the end-of-video listener stays on while the ad plays in the same player, the notice can go out at the wrong time. Remove the listener on pause and put it back when the content returns.
After the post-roll, IMA asks to resume the content. If the video has already ended, do not tell it to play again, or it may restart without the person asking.
One possible reason is not telling IMA that the video ended. Google asks that the site signal the end of the content so the SDK plays the end break, if one is scheduled.
Not necessarily. With rules (Ad Manager 360), the post-roll comes scheduled in the VMAP. Without rules, the player can request the ad at the end of the video and send vpos=postroll in the tag.
No. It plays after the content ends, in the same player.
Library
Everything on this page follows Google's official documentation. Read it straight from the source:
The audit reads the site as a visitor would, without clicking anything, and shows what to fix.