Signaling content end at the end of the ad
The content-end signal is only for when the video ends. Since IMA may use the same player for ads, signaling at the end of an ad confuses the SDK.
Implementation guide
Mid-roll video ads
A video ad that comes in the middle of the content, like a commercial break, and then the video continues from where it stopped.
Understand it in 1 minute
Think of a football game on TV: at halftime the commercials come in and then the game comes back. The mid-roll is the commercial break of your site's video. The video stops at an agreed point, plays one or more ads inside the same player and then continues exactly where it stopped. When several ads come in a row, Google calls this group an ad pod, which is like a block of commercials.
Who decides when the breaks happen? In Ad Manager, this is done by video ad rules. They say when and how ads appear inside a video. You can choose fixed times, such as seconds 60, 120 and 180, or a break every so many seconds. You can also use cue points, which are small markers inside the video showing the best places to stop, such as the end of a scene. The player receives this plan in a VMAP response, which works like a schedule of the breaks, and the IMA SDK plays each break at the right time.
There are important details. Video ad rules only exist in Google Ad Manager 360 with an advanced video contract. For mid-roll to work, Ad Manager needs to know how long the video is and where the stopping points are. You can register your videos in Ad Manager (this is called content ingestion) and send the cmsid and vid codes in the tag. Or, without that registration, you can send the video duration in seconds (vid_d) and the list of stopping points in milliseconds (allcues). Google says the duration must be sent to get mid-rolls.
IMA also needs to know at which second the video is. That is why you hand the video element itself to IMA and start the ads manager before the content begins, because that is when it starts counting time. The mid-roll makes sense in videos where the person stays watching for a good while. Always think about the viewer: Ad Manager lets you limit how many ads go in each break, how long each can last and use frequency caps per break, per video or both.
Step by step
Implemented example
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script>
// Vídeo de 10 minutos (vid_d=600)
// com intervalos em 2 e 5 minutos (allcues em ms)
var adsRequest = new google.ima.AdsRequest();
adsRequest.adTagUrl = 'https://pubads.g.doubleclick.net/gampad/ads?' +
'iu=/1234567/exemplo&sz=640x480&env=vp&gdfp_req=1' +
'&ad_rule=1&output=vmap&vid_d=600&allcues=120000,300000' +
'&unviewed_position_start=1&vpa=click&vpmute=0&plcmt=1' +
'&description_url=https%3A%2F%2Fwww.exemplo.com%2Fvideo&correlator=';
adsRequest.linearAdSlotWidth = 640;
adsRequest.linearAdSlotHeight = 400;
adsLoader.requestAds(adsRequest);
adsLoader.addEventListener(
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
function (e) {
// O próprio <video> informa o tempo atual (currentTime) ao IMA
adsManager = e.getAdsManager(video);
adsManager.addEventListener(
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
function () { video.pause(); });
adsManager.addEventListener(
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
function () { video.play(); });
});
// No clique de play: init() antes de tocar o conteúdo
// adDisplayContainer.initialize();
// adsManager.init(640, 360, google.ima.ViewMode.NORMAL);
// adsManager.start();
</script>What Google recommends
Tips
Watch out
The content-end signal is only for when the video ends. Since IMA may use the same player for ads, signaling at the end of an ad confuses the SDK.
IMA only starts tracking time when the ads manager is initialized. That is why Google asks you to initialize it always before playing the content.
If your player updates the time during bar dragging, Google recommends giving IMA your own object that reports the correct time.
Video ad rules are only for Google Ad Manager 360 with an advanced video contract. In a regular account, this option does not appear.
No. Google says content ingestion is not required for mid-rolls with ad rules. Without it, send the duration (vid_d) and the stopping points (allcues) in the tag.
It is a small marker at a point in the video saying a break can go there. In the tag, cue points are in milliseconds, separated by commas, like 10000,20000.
Google says ad rules are required for Ad Manager to return mid-rolls, and they are an Ad Manager 360 feature. The video duration (vid_d) must also be sent.
You decide in the pod with Maximum number of ads. The option No maximum only exists in Optimized pods, which also let you limit the total duration of the break.
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.