Thank you!

  • websites



amp-ima-video embeds a video player for instream video ads that are integrated with the IMA SDK.

The plugin provides a video player with controls for your content, and requests and displays ads from a VAST-compliant ad server of your choice using the IMA SDK.


Import the amp-ima-video component.

<script async custom-element="amp-ima-video" src=""></script>

Basic usage

The amp-ima-video component HTML accepts up to two unique types of HTML nodes as children - source tags for content video, and track tags for subtitles. Both of these can be used in the same way as the standard video tag.

The component requires an ad tag, provided in data-tag, which is a URL to a VAST-compliant ad response (for examples, see IMA Sample Tags). It has an optional data-poster attribute for a poster image to be displayed before playback.

<amp-ima-video id="myVideo" width="640" height="360" layout="responsive" data-tag="" data-poster="/static/samples/img/ima-poster.jpg">
  <source src="" type="video/mp4">


Provide a format string in the data-ad-label attribute to customize the ad disclosure that is displayed while an ad is playing. This allows users to support ad disclosures in different languages.

A format string should look like "Ad (%s of %s)". The "%s" in the format string is replaced with the current ad number in the sequence and the total number of ads, respectively (e.g. Ad 2 of 3). If no value is given, this defaults to "Ad (%s of %s)".

<amp-ima-video id="myVideo2" width="640" height="360" layout="responsive" data-tag="" data-poster="/static/samples/img/ima-poster.jpg" data-ad-label="Publicidad (%s de %s)">
  <source src="" type="video/mp4">


Use the autoplay attribute to play video automatically without requiring the user to press "play".

Optionally, use data-delay-ad-request="true" to delay an ad request until either the user scrolls the page, or for 3 seconds, whichever occurs first. The default behavior of the amp-ima-video component is to request an ad on the AMP page load which has the effect of being counted as 'code served' even if there is no impression.

<amp-ima-video id="myVideo3" width="640" height="360" layout="responsive" data-tag="" data-src="" data-delay-ad-request="true" autoplay>
Besoin de plus amples explications ?

Si les explications de cette page ne répondent pas à vos questions, n'hésitez pas à contacter d'autres utilisateurs d'AMP pour discuter de votre cas d'utilisation spécifique.

Se rendre sur Stack Overflow
Une fonctionnalité n'a pas encore été expliquée ?

Le projet AMP encourage fortement votre participation et vos contributions ! Nous espérons que vous deviendrez un membre régulier de notre communauté open source, mais nous serons également ravis de recevoir des contributions ponctuelles concernant les questions qui vous intéressent particulièrement.

Modifier l'exemple sur GitHub