Ads in Video

Fill the ad slots inside an MP4E video — a billboard, a poster, a screen — and play video ads before, during and after it, from your own VAST ad server, and follow every request and impression.

Overview

A video can carry ad slots: surfaces in the picture — a billboard on a building, a poster, a screen — that the official Ad slots plugin (mp4e:ad-slots) fills from an ad server. The creator declares the slots and their house creatives; your page decides whether to sell them by naming a VAST 4 ad server. Any server that answers VAST can be used. MP4E runs no ad server and takes no part in the sale.

Without your ad server the slots show the creator's house creatives and the video plays as made. The same file plays on every site.

Connecting your ad server

Set the plugin's ad server settings with overrides, under plugins['mp4e:ad-slots'].defaultConfig. Your settings merge with the creator's slots; the file is not changed.

Fill the slots from your ad server
import { useMemo } from 'react';
import { MP4EPlayer } from '@mp4e/react';

const TAG = 'https://ads.example.com/vast?market={country}&sz={slots}&correlator={cachebuster}';

export function StreetScene() {
  // Keep overrides stable: every change restarts the plugin and requests ads again.
  const overrides = useMemo(() => ({
    plugins: { 'mp4e:ad-slots': { defaultConfig: { tagUrl: TAG } } },
  }), []);

  return <MP4EPlayer src="/street.mp4" overrides={overrides} />;
}
PropTypeDefaultDescription
tagUrlstring''Your VAST tag URL, absolute (https://…), with the macros below. One request fills every slot. Empty: no ad server, house creatives.
slotTagsRecord<string, string>{}A tag for one slot, by slot id ({ screen: "https://…" }), used instead of tagUrl for that slot. Slots that share a tag share one request.
countryVariablestring'viewerCountry'The variable holding the viewer's country, sent as {country}. Every change to it requests new ads.
viewerIdVariablestring''A text variable holding your id for this viewer, sent as {viewerId} — only with the viewer's consent (below). Empty: never sent.

The plugin requests ads when the video loads and again whenever the country variable changes; an answer to an older request is ignored.

Tag macros

Values are URL-encoded; any other text in the tag is sent as written.

PropTypeDefaultDescription
{country}macro-The value of the country variable, such as JP.
{slots}macro-The sizes of the slots this request fills, in order: 970x250,300x600,1280x720.
{cachebuster}macro-A new eight-digit random number for every request.
{viewerId}macro-The viewer id, or empty when the viewer withholds it.

What the answer may hold

PropTypeDefaultDescription
InLine adVAST 2.0–4.x-The first <Ad> with an <InLine> is used. An answer whose ads are all Wrappers falls back with reason wrapper.
Linearvideo slot-The progressive video/mp4 MediaFile closest to the slot's size, with its <Duration>. It plays muted, in the zone.
Companionimage slots-Companions with an image StaticResource (JPEG, PNG, GIF, WebP), each to the image slot with the nearest shape, each used once.
TrackersURLs-<Impression>, and creativeView, start, firstQuartile, midpoint, thirdQuartile and complete in <TrackingEvents>. The macros [CACHEBUSTING], [TIMESTAMP] and [IFA] are filled. [IFA] is the viewer id only when your tag carries {viewerId} and the viewer allows it; otherwise it is empty.
Relative URIsURLs-Resolved against the tag URL.
Your server must allow your page's origin
The plugin's requests are made by your page, without cookies, so the ad server (and the creatives' host) must send CORS headers for your page's origin. Creatives load into the video's picture, which also needs CORS. Trackers are fired the same way; a tracker that does not send CORS headers still receives its request.

Following the ads

The plugin's events reach your page as plugin:mp4e:ad-slots:<event> through onEvent, and rules in the video can use them too:

Log impressions
<MP4EPlayer
  src="/street.mp4"
  overrides={overrides}
  onEvent={(event, data) => {
    if (!event.startsWith('plugin:mp4e:ad-slots:')) return;
    const name = event.slice('plugin:mp4e:ad-slots:'.length);
    if (name === 'impression') {
      analytics.track('ad_impression', { slot: data.slotId, creative: data.creativeId, sent: data.sent });
    }
    if (name === 'adFallback') console.info(`${data.slotId}: house creative (${data.reason})`);
  }}
/>
PropTypeDefaultDescription
adRequested{ requestId, slots, country, sent, server }-A request went out. sent lists the viewer context in it: country, viewerId. server is your ad server's origin.
adFilled{ requestId, slotId, kind, creativeId, src, fit }-A slot got a creative. fit is contain when its shape differs from the slot's.
impression{ requestId, slotId, kind, creativeId, seconds, sent }-A filled slot was on screen 1 s (image) or 2 s of playing (video); its trackers fired. sent is what your server received with it.
quartile{ requestId, slotId, creativeId, event, seconds }-The video ad reached start, firstQuartile, midpoint, thirdQuartile or complete on screen.
viewTime{ slotId, creativeId, filled, seconds }-A slot left the screen or changed creative: how long it was shown (filled is false for a house creative).
adFallback{ requestId, slotId, reason }-A slot keeps its house creative; reason says why (see When there is no ad).
adError{ requestId, reason, message }-A request failed.

Country, viewer id and privacy

The country comes from a variable your page sets — the file never works it out itself:

Set the viewer's country
// Your own geo or locale logic decides the country; the plugin requests again.
playerRef.current?.setVariable('viewerCountry', 'JP');

A viewer id is sent only when viewerIdVariable names a variable holding one and the viewer has turned off both Do not track and Do not share identity in the player's menu (see Viewer Preferences). The plugin checks again before every tracker it fires, so a viewer who turns either on stops sending it at once. The sent field of adRequested and impression says what went out.

Trackers get the viewer id (their [IFA] macro) only when the ad request carried it: your tag must contain {viewerId}. A tag without the macro sends the id nowhere, and every tracker's [IFA] is empty — even with the viewer's consent. Keep {viewerId} in the tag even when your server reads the id only from its trackers.

Send your viewer id, with consent
const overrides = useMemo(() => ({
  variables: [{ id: 'adViewerId', name: 'Ad viewer id', type: 'text', default: '' }],
  plugins: { 'mp4e:ad-slots': { defaultConfig: {
    tagUrl: 'https://ads.example.com/vast?market={country}&uid={viewerId}&correlator={cachebuster}',
    viewerIdVariable: 'adViewerId',
  } } },
}), []);

// Once you know the viewer:
playerRef.current?.setVariable('adViewerId', myAdId);

Network rules

The plugin may reach only the domains it declares (the demo ad server) unless your page allows more: allow your ad server's and trackers' domains for the plugin in config.pluginSecurity (see Configuration), or approve them in onNetworkGate — quickly: an ad request that is not answered within 2 seconds falls back to the house creatives.

Allow your ad server
<MP4EPlayer
  src="/street.mp4"
  overrides={overrides}
  config={{
    pluginSecurity: {
      '*': { network: 'none' },
      'mp4e:ad-slots': { network: ['ads.example.com', 'trk.example.com'] },
    },
  }}
/>

When there is no ad

A slot that is not filled shows the creator's house creative, and the plugin emits adFallback with the reason. A creative that fails to load in the picture leaves the surface showing the original footage. The video always plays.

PropTypeDefaultDescription
timeoutreason-No answer within 2 seconds.
networkreason-The request failed, was refused by your network rules, or the server answered an HTTP error.
invalidreason-The answer is not VAST XML, or could not be applied.
emptyreason-No ad, or nothing the player can show. No adError is emitted: no fill is normal.
wrapperreason-Only Wrapper ads.
noMatchreason-The answer had no creative for this slot (no linear for the video slot, more image slots than companions).

Ad breaks on a live stream

On a live stream the ads are usually stitched into the stream itself. The player does not play them; it reads the break markers the stream carries (a SCTE-35 splice-out) and hides your overlays for the length of the break, so a product card never sits on another brand's ad. See Streams: ad breaks in the stream. The breaks on this page (interstitials) replace the video's source and are refused on a stream.

Linear ads (pre-, mid- and post-rolls)

A linear ad takes over the player for a moment: a preroll before the video, midrolls during it, a postroll at the end. The official Linear ads plugin (mp4e:linear-ads) asks your VAST 4 ad server for an ad when a break is due and hands it to the player as a break. The player pauses the video at its position and plays the ad in the same video element — so it works in full screen and on devices that play one video at a time — with the Ad controls (mp4e:ad-controls) on top: pause and mute, the time remaining, a skip button when the ad allows it, and Learn more. Then the video resumes where it was, playing or paused as it was.

The player decides whether a break may run (your policy, below, and the creator's), when it starts and ends, and when it may be skipped; the ad's skip offset and length are requests. While a break runs, nothing can play, pause or seek the video, no plugin or rule can change its speed or volume (the ad plays with the viewer's sound; the viewer can pause and mute the ad itself with the Ad controls, and a mute they change carries over to the video after it), and the player draws a label — Ad, or Ad · Acme Shoes when the ad names its advertiser — that the ad cannot cover. If anything fails — no answer, an ad that will not load or fails while it plays, a break that does not start within the ready timeout (readyTimeoutMs, 8 seconds by default) — the video simply plays on.

Setting up linear ads

  1. Both plugins must be in the video: installed by its creator from the marketplace, or added by you through overrides, under plugins['mp4e:linear-ads'] and plugins['mp4e:ad-controls'].
  2. Name your ad server in plugins['mp4e:linear-ads'].defaultConfig.
  3. Let the plugin request breaks: config.interstitials.allowPlugins must include 'mp4e:linear-ads'. Without it every break is refused.
  4. Allow your ad server and its trackers: the plugin declares no domains, so approve them in onNetworkGate (or a config.pluginSecurity rule, see Network rules).
Pre-, mid- and post-rolls from your ad server
import { useMemo } from 'react';
import { MP4EPlayer } from '@mp4e/react';
// The two plugin definitions, as the marketplace installs them.
import { linearAdsPlugin, adControlsPlugin } from './adPlugins';

const TAG = 'https://ads.example.com/vast?correlator={cachebuster}';

export function Episode() {
  // Keep both stable: a change restarts the ad plugin.
  const overrides = useMemo(() => ({
    plugins: {
      'mp4e:ad-controls': adControlsPlugin,
      'mp4e:linear-ads': {
        ...linearAdsPlugin,
        defaultConfig: {
          ...linearAdsPlugin.defaultConfig,
          tagUrl: TAG,
          breaks: [{ offset: 'start' }, { offset: '00:05:00' }, { offset: 'end' }],
        },
      },
    },
  }), []);
  const config = useMemo(() => ({
    interstitials: { allowPlugins: ['mp4e:linear-ads'], maxPodSeconds: 60 },
  }), []);

  return (
    <MP4EPlayer
      src="/episode.mp4"
      overrides={overrides}
      config={config}
      onNetworkGate={(request, resolve) => {
        // The plugin reaches your ad server and its trackers only with your approval.
        resolve(new URL(request.url).hostname.endsWith('.example.com'));
      }}
    />
  );
}
When the creator installed both plugins
// The video already has both plugins installed: name your ad server only.
const overrides = useMemo(() => ({
  plugins: { 'mp4e:linear-ads': { defaultConfig: { tagUrl: TAG } } },
}), []);
PropTypeDefaultDescription
tagUrlstring''Your VAST tag URL, absolute (https://…), requested once for each break. {cachebuster} is filled with a new random number; {viewerId} is always empty. Empty, and no vmapUrl: no ads.
vmapUrlstring''A VMAP URL. Its ad breaks, each with its own VAST tag, are used instead of breaks. If it cannot be read, no ads play and adError reports reason vmap.
breaks{ offset: string; breakId?: string }[][{ offset: 'start' }]When the ads play: offset is start, end, HH:MM:SS(.mmm) or N% of the video. breakId names the break in events (default break_<n>). Without a VMAP only.
templatestring'mp4e:ad-controls'The plugin that draws the break's controls. It must be in the video's plugins too.
targetWidthnumber1280The ad's MP4 closest to this size plays.
targetHeightnumber720See targetWidth.
prerollStart'onPlay' | 'onLoad''onPlay'onPlay: the preroll is requested once the video plays — if your page does not autoplay, no ad shows until the viewer presses play, and a viewer who starts past the first second gets no preroll. onLoad: requested as soon as the plugin starts, even while the video is paused.
adControls{ showPause?: boolean; showMute?: boolean }{ showPause: true, showMute: true }Whether the viewer can pause and mute the ad (the Ad controls' Pause and Mute buttons). false hides that button.
CORS for the ad server and the ad video
The plugin's VAST requests and trackers are made by your page, without cookies, so your ad server must send CORS headers for your page's origin. The ad video plays in the player's video element, which loads with CORS: the server of the ad's MP4 must allow your origin too, or the break fails and the video plays on.

When breaks play

  • A break is due when playback moves forward across its offset. end starts a quarter second before the end, while the video still plays.
  • A seek past several breaks plays the last one passed; afterwards the viewer is where the seek landed.
  • Each break is tried once: one that is refused, fails, or has no ad is not asked for again.
  • The preroll plays when the video starts playing at its beginning (prerollStart onPlay): a page that does not autoplay shows no ad until the viewer presses play, and after the ad the video plays. When the plugin restarts in the middle of the video (for example after your overrides change), the breaks already passed do not play.
  • Each break plays the first InLine ad of the answer, its progressive MP4 closest to the target size. The ad's skip offset becomes the break's skip time and its click-through becomes Learn more. From an ad pod it plays the first ad; an answer whose ads are all Wrappers plays no ad.
  • A break lasts at most the ad's length plus 10 seconds of playing time: an ad that stalls ends there. Time the viewer keeps the ad paused does not count.
  • Impression, quartile, skip, pause, resume, mute, unmute and click trackers fire as the break reports them.
  • Turn the ad's Pause or Mute button off with defaultConfig.adControls, e.g. { showPause: false }.
  • No viewer id is sent: {viewerId} in a tag and [IFA] in trackers are always empty.

Your break policy

config.interstitials (see Configuration) limits every break, whoever asks for it — your page, a plugin, or the video's rules. Without it, breaks are on and only your page may request one. The video's creator can restrict breaks too (turn them off, keep them out of parts of the video, space them out); the player applies both, and neither can loosen the other.

PropTypeDefaultDescription
enabledbooleantruefalse blocks every break — for an ad-free account — even when the video's creator built ads into it.
allowPluginsstring[][]Plugins (namespace:identifier) that may request a break. Linear ads needs 'mp4e:linear-ads' here. By default only your page may request one.
allowRulesbooleanfalseLet the video's own rules request breaks (the requestInterstitial action, with a template).
maxBreaksnumberno limitBreaks per video.
maxBreaksPerHournumberno limitBreaks started in the last hour.
maxPodSecondsnumbernoneThe longest a break may run, in seconds. A break that asks for more is cut to this.
minSpacingSecondsnumbernoneSeconds of the video between one break and the next.
allowedPlacements('preroll' | 'midroll' | 'postroll' | 'other')[]allThe placements you allow.
allowedMediaOriginsstring[]anyThe origins the ad video may come from, exactly as scheme://host[:port] (https://cdn.example.com).
readyTimeoutMsnumber8000How long a break may take to start before it is given up and the video plays on.
maxHoldSecondsnumber120The longest a break may wait on the ad's last frame (hold, below), in seconds. A request asking for more is refused (invalid). An invalid value allows no hold. Linear ads asks to hold for its holdSeconds (30 by default): a maxHoldSeconds below that refuses every shoppable break, and the ad is not shown.
secondary{ plugins?: 'official' | 'signed' | 'any'; disabled?: object; gated?: string[] }{ plugins: 'official' }What the ad itself may do — see What an ad may do. A secondary, secondary.disabled or secondary.gated of the wrong type turns breaks off.
A wrong value restricts
A key with the wrong type or an invalid value never widens what is allowed: an invalid enabled turns breaks off, an invalid cap is 0, an invalid list is empty. A maxPodSeconds of 0 allows no break.

Requesting a break yourself

Your page can run a break without the Linear ads plugin — from your own ad logic — with requestInterstitial on the player ref. You give the ad video and either a template plugin to draw the break (Ad controls must be in the video's plugins) or a whole document of your own; the answer is { ok: true, breakId } or { ok: false, reason }.

Run a mid-roll now
const answer = await playerRef.current?.requestInterstitial({
  placement: 'midroll',
  template: { plugin: 'mp4e:ad-controls', config: { clickThroughUrl: 'https://acme.example/' } },
  media: { src: 'https://cdn.example.com/acme-15s.mp4', width: 1280, height: 720, durationSeconds: 15 },
  skippableAfter: 5,
  advertiser: 'Acme Shoes',
});
if (!answer?.ok) console.info('No break:', answer?.reason);

// End the break early (it ends with reason cancelled):
await playerRef.current?.cancelInterstitial();
PropTypeDefaultDescription
placement'preroll' | 'midroll' | 'postroll' | 'other'-Where the break is. The three ad placements get the Ad label; other does not.
template{ plugin, config? } | { plugin, config?, box? }[]-The plugin that draws the break (for example mp4e:ad-controls) and its config — or a list of up to 4 plugins drawn in order, later ones above, each in its box: { x, y, width, height } in percent of the picture (default the whole picture). Every plugin must be in the video's plugins. Give template or document, not both.
documentobject-Instead of a template: a whole MP4E document to run over the ad video — your own layers, overlays and plugins (it carries its plugins itself). Only your page may pass one; a plugin or a rule must use a template.
media{ src, width, height, durationSeconds, startSeconds? }-The ad video: an absolute http(s) URL, its size in pixels and its length in seconds (all greater than 0). startSeconds starts the ad partway (at least 0 and less than its length); the quartiles it starts past are not reported.
skippableAfternumber-Seconds into the ad after which the viewer may skip. Omitted: not skippable.
maxSecondsnumber120The longest the break may run, at most your maxPodSeconds. The break ends then even if the ad has not. Time the ad is paused does not count; a break kept paused ends 5 minutes past maxSeconds — unless the viewer has interacted with the ad (interstitial:engaged).
hold{ maxSeconds: number }-When the ad ends, keep the break on its last frame for up to maxSeconds (more than 0, at most your maxHoldSeconds), so the viewer can act on what it shows. The ad's plugin can end the hold early (a Continue button), never extend it; the break then ends as completed, or as returned when the plugin gives a reason label. When the viewer interacts with the ad (interstitial:engaged) the hold has no deadline any more. Omitted: the break ends with the ad.
advertiserstring-Shown in the label: Ad · Acme Shoes.
declaredobject-Data you pass to the break (a campaign, a partner tag). The break's plugin reads it; nothing else of the video is passed.

Why a request was refused:

PropTypeDefaultDescription
invalidreason-The spec is incomplete or malformed.
busyreason-A break is already running.
depthreason-Asked from inside a break.
disabledreason-Breaks are off — your enabled: false, or the video's creator turned them off.
initiatorreason-A plugin not in allowPlugins, or a rule without allowRules.
sourcereason-The ad video is not from an allowed origin, or a plugin or rule passed a document.
placementreason-The placement is not in allowedPlacements.
templatereason-The template plugin is not in the video's plugins.
pluginreason-A plugin the break would run is not allowed by your secondary.plugins — by default, any plugin that is not signed by MP4E.
windowreason-The creator keeps breaks out of this part of the video.
spacingreason-Too close to the last break.
capreason-maxBreaks or maxBreaksPerHour reached, or maxPodSeconds is 0.
notReadyreason-The player has not started yet.
errorreason-The request could not be answered.

What an ad may do

An ad runs as its own small document over the ad video, with its own config — never yours. config.interstitials.secondary sets it:

  • Which plugins it may run — plugins: official (the default) admits only plugins carrying a valid MP4E signature, as the marketplace publishes them; signed also admits plugins signed by a key in your trustedSigners; any checks nothing. A break that would run any other plugin is refused with reason plugin and the video plays on. A wrong value counts as official. A signature covers a plugin's code, not the domains its manifest lists, so unless plugins is any a plugin inside an ad reaches no domain of its own: every request it sends goes to your onNetworkGate.
  • Your gates, named — the ad's actions listed in gated go to your onActionGate, and a request outside a plugin's declared domains goes to your onNetworkGate, each with an interstitial field — { breakId, advertiser, placement } — so you can ask the viewer before anything is sent. Your gate timeouts apply as for the video's own plugins. Only secondary.gated applies to the ad — your own top-level gated does not reach it. A request's pluginId names the plugin's frame (for a plugin in an ad, an id like plugin-interstitial-ui-2), not the plugin, so decide on interstitial, the method and the URL. An approval that arrives after the break has ended sends nothing.
  • What it may not show — disabled suppresses content of the ad, like your disabled does for the video.
  • Nothing it can remember — a plugin's storage inside a break starts empty and is gone when the break ends, so an ad cannot recognize a viewer across breaks or videos.
  • No Intelligence — plugins in an ad are never served the video's Intelligence.
  • What counts as engaging — an ad's plugin tells the player when the viewer has interacted with it (interstitial:engaged): from then on the hold has no deadline and a paused ad is not cut off, because the viewer may have stepped away to find a wallet. The player cannot tell a real gesture from a scripted one, so the plugin decides what counts; under the default official only MP4E-signed plugins run in an ad. An engaged break waits for the viewer, who resumes, skips or presses Continue — or answers the ad's card (such as Remind me), which can send them back to the video at once; the break then ends as returned with the card's own label. Your page can end it at any time with cancelInterstitial(), for example after a limit of your own once interstitial:engaged arrives.
  • The Ad label stays above everything the ad draws.
Ask the viewer before an ad sends an order
<MP4EPlayer
  src="/episode.mp4"
  overrides={overrides}
  config={{ interstitials: { allowPlugins: ['mp4e:linear-ads'] } }}
  onNetworkGate={async (request, resolve) => {
    if (request.interstitial) {
      // A plugin inside an ad break (request.pluginId is its frame's id, not a plugin name):
      // ask the viewer, naming the advertiser.
      const who = request.interstitial.advertiser ?? 'the advertiser';
      resolve(await sheet.confirm(`Send your order to ${who}?`));
      return;
    }
    resolve(new URL(request.url).hostname.endsWith('.example.com'));
  }}
/>

Outcomes from an ad

An interactive ad can tell you what the viewer did in it — placed an order, submitted a form, asked to be reminded. Its plugin reports the outcome; the player passes it to your onEvent, the video's rules and plugins as interstitial:outcome, with only the fields below: an id (orderId, productId, variant, formId) is 1 to 64 letters, digits, dots, underscores, colons or hyphens; a field with a wrong value is left out, and no other field passes. No outcome can carry a viewer's email, name or free text. declared is what was passed when the break was requested (your campaign, your affiliate tag) — the ad cannot change it. A plugin reports only the types its manifest declares, at most 20 per break.

PropTypeDefaultDescription
orderPlaced{ orderId, value, currency, productId, variant }-The viewer placed an order. value is a number of at least 0; currency is three capital letters (USD).
formSubmitted{ formId }-The viewer submitted a form, such as an offer signup.
remindLater{}-The viewer asked to see the ad again later.
productSaved{ productId }-The viewer saved a product.
clicked{}-The viewer acted on the ad.
Credit an order to your campaign
<MP4EPlayer
  src="/episode.mp4"
  overrides={overrides}
  config={config}
  onEvent={(event, data) => {
    if (event === 'interstitial:outcome' && data.type === 'orderPlaced') {
      analytics.track('ad_order', {
        order: data.data.orderId, value: data.data.value, currency: data.data.currency,
        advertiser: data.advertiser, campaign: data.declared?.campaign, placement: data.placement,
      });
    }
  }}
/>

Following breaks

Every break reports to onEvent (and to the video's rules and plugins), whoever asked for it. The Linear ads plugin adds its own events as plugin:mp4e:linear-ads:<event> — adRequested, adStarted, adProgress, adSkipped, adCompleted, adEnded, adRefused, adError, adOutcome, adReminder (see Linear ads). A play, pause or seek asked for during a break — and a setVolume or setPlaybackRate, yours included — is refused with action:blocked, reason interstitial.

Count breaks
<MP4EPlayer
  src="/episode.mp4"
  overrides={overrides}
  config={config}
  onEvent={(event, data) => {
    if (event === 'interstitial:started') analytics.track('ad_break_start', { placement: data.placement });
    if (event === 'interstitial:ended') analytics.track('ad_break_end', { reason: data.reason, seconds: data.durationWatched });
    if (event === 'plugin:mp4e:linear-ads:adRefused') console.info('Break refused:', data.reason);
  }}
/>
PropTypeDefaultDescription
interstitial:refused{ reason, placement }-A request was refused (reasons above). placement is null for an invalid spec.
interstitial:started{ breakId, placement }-The ad is playing; the video waits at its position.
interstitial:progress{ breakId, event, atSeconds? }-event is start, firstQuartile, midpoint, thirdQuartile, complete, skip (with atSeconds, where in the ad it was skipped), pause, resume, mute or unmute (the viewer paused, played again, muted or unmuted the ad). A pause is reported about a tenth of a second after it happens.
interstitial:clicked{ breakId }-The viewer clicked through (Learn more).
interstitial:engaged{ breakId, placement }-The viewer interacted with the ad (the ad's plugin reported it). Once per break. From then on nothing returns the video by itself: the hold has no deadline and a paused ad is not cut off. The viewer's Continue or skip, your cancelInterstitial(), or — for a break without a hold — the ad's own end ends the break. No personal data.
interstitial:holding{ breakId, placement }-The ad ended and the break waits on its last frame (a break with hold).
interstitial:outcome{ breakId, placement, type, data, advertiser, declared }-The viewer did something in the ad — see Outcomes from an ad. declared is what was passed when the break was requested.
interstitial:ended{ breakId, placement, reason, label?, durationWatched, outcomes }-The video is back. reason: completed, skipped, returned, maxSeconds, cancelled or error. returned means the ad's own card sent the viewer back to the video (after they engaged with the ad, or from the hold when the card names a reason); label is the card's own reason (for example remindLater, orderPlaced), present only for returned and only when the card gave one. durationWatched is in seconds. outcomes lists the outcome types the break reported, in order, each once.
interstitial:error{ breakId, stage, reason }-The break failed (stage start, run or restore; reason media when the ad video fails while it plays); it ends with reason error and the video plays on. breakId is the failed break's id.