Open workspace

Implementation guide

Video overlay ad

Overlay ads (non-linear ads)

A text or image ad that covers a part of the video while it keeps playing, without stopping the content.

  • Ad Manager
  • Ad Exchange
  • AdSense (via Ad Manager)
  • inside the video player, over a part of the content
Desktop
Mobile

Understand it in 1 minute

What a video overlay ad is

You know when you watch a game on TV and a small ad appears in a strip of the screen, but the game keeps going? The overlay ad is similar. It is a text or image ad that covers only a part of the video while it plays. The video does not stop: the person keeps watching, and the ad sits on top, like a sticker on a small piece of the screen.

In the world of video ads, this is called a non-linear ad. Linear is the ad that takes the place of the video, like the pre-roll, which stops the content. Non-linear is the one that shares the screen with the video. In Ad Manager, there is a creative type called Overlay, which Google describes as an ad that covers part of the video content while it plays. The ad can be text, image or both. You can upload the file to Ad Manager or use a remote file, and you can set the duration, scale and third-party tracking links.

On the site, the IMA SDK shows the overlay. It is Google's code package for ads in players. In the request, the player provides the width and height of the rectangular area where the non-linear ad can appear. Google says this size is required for non-linear ads and that it helps choose the ad, but it does not need to match its real size. When the ad loads and is not linear, Google's sample code keeps the video playing, so the ad sits on top of the moving content.

It has important rules. If video ad rules are active on the network or in the tag itself, overlay ads cannot be served. And, under Google's video policy, the video and ad controls cannot be covered, hidden or non-working. So the overlay must fit in the right area without covering the play, pause and volume buttons.

Step by step

How to implement

  1. Create the Overlay creativeIn the video line item, add a creative of the Overlay type. Upload the file to Ad Manager or use a remote file and, if you want, set the duration, scale and tracking.
  2. Check the ad rulesIf video ad rules are active on the network or in the tag, overlay ads are not eligible. Check this before counting on the overlay.
  3. Provide the non-linear area in the requestIn IMA's AdsRequest, provide the width and height of the non-linear area. Google says these values are required for non-linear ads.
  4. Keep the video playingWhen the ad loads, check whether it is linear. If it is not, tell the video to keep playing, as in Google's example.
  5. Adjust to the player sizeWhen the window changes size, resize the AdsManager with the video size, so the overlay stays in the right place.

Implemented example

The code and how it looks on screen

It goes in the player code with IMA: it provides the overlay area in the request and keeps the video playing when the loaded ad is not linear.
<script>
  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&output=vast' +
      '&unviewed_position_start=1&vpa=click&vpmute=0&plcmt=1' +
      '&description_url=https%3A%2F%2Fwww.exemplo.com%2Fvideo&correlator=';

  // Área para anúncios lineares (que param o vídeo)
  adsRequest.linearAdSlotWidth = 640;
  adsRequest.linearAdSlotHeight = 400;

  // Área para anúncios NÃO lineares (overlay), obrigatória para eles
  adsRequest.nonLinearAdSlotWidth = 640;
  adsRequest.nonLinearAdSlotHeight = 150;

  adsLoader.requestAds(adsRequest);

  // Quando o anúncio carrega: se não for linear, o vídeo segue tocando
  function onAdLoaded(adEvent) {
    var ad = adEvent.getAd();
    if (!ad.isLinear()) {
      video.play();
    }
  }
  // adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdLoaded);
</script>
On desktopA strip with text or an image appears over a part of the video, while the video keeps playing underneath.
On mobileIt also appears over a part of the video inside the player, without pausing the content, if the player and the ad are set up for it.

What Google recommends

Do and don't

Allowed

  • Show a text ad, an image ad or both covering part of the video while it plays.
  • Upload the Overlay creative to Ad Manager or use a remote file, with optional duration, scale and tracking.
  • Keep the video playing while the non-linear ad appears.
  • Using Overlay creatives in publisher-hosted Programmatic Guaranteed.

Not allowed

  • With video ad rules active in the network or in the tag, overlay ads cannot be served.
  • You cannot let the overlay cover, hide or block the video and ad controls.
  • You cannot request a non-linear ad without providing the width and height of the non-linear area: Google says they are required.
  • Do not use IMA products to earn money from YouTube videos.
  • Do not have more than one visible autoplay player playing at the same time.

Tips

To do it right

Watch out

Common errors

Using overlay with ad rules on

Google says that, with video ad rules active in the network or in the tag, non-linear ads are not eligible. The overlay simply does not appear.

Forgetting the non-linear area

Without providing the width and height of the non-linear area in the request, IMA does not have the required criterion to choose this type of ad.

Pausing the video on the overlay

The overlay was made to appear while the video plays. Google's example tells the video to keep playing when the loaded ad is not linear.

Covering the player buttons

If the overlay sits on top of the controls, the person cannot pause or change the volume, and that goes against Google's video policy.

Frequently asked questions

Does the overlay stop the video?

No. It covers only a part of the video while the content keeps playing. Linear ads, like pre-roll, are the ones that stop the video.

Can I use overlay together with ad rules?

No. With video ad rules active in the network or in the tag, overlay ads are not eligible.

What size should I provide?

Google's example uses 640 by 150. The value is used to choose the ad and does not need to match its real size.

Can the overlay be text only?

Yes. Google says overlay ads can be text, image or both.

Library

Official Google source

Everything on this page follows Google's official documentation. Read it straight from the source:

Does your site use this format the right way?

The audit reads the site as a visitor would, without clicking anything, and shows what to fix.

Run an audit