AMP

Important: this documentation is not applicable to your currently selected format email!

amp-google-read-aloud-player

Description

Embeds the Google Read Aloud Player.

 

Required Scripts

<script async custom-element="amp-google-read-aloud-player" src="https://cdn.ampproject.org/v0/amp-google-read-aloud-player-0.1.js"></script>

Supported Layouts

Behavior

Embeds the Google Read Aloud player. This player reads the content of your page out loud.

Attributes

data-api-key (required) API key identifies the publisher, and must be provided in order to use the player.

Each API Key is correlated to a closed list of domains that represent the publisher domains. Only URLs that belong to one of these domains are able to be played by the web player.

During the piloting phase, the API Key will be provided to the publisher by Google. Other API Keys that were generated using the Google Cloud Console won’t work.
data-tracking-ids (required) The list of the Google Analytics tracking IDs to send the player metrics to (comma separated).

You are required to have a Google Analytics tracking ID in order to use this player during the pilot period. The tracking ID will be provided to you by Google.

If you want to send the player metrics also to your Google Analytics account, add your tracking ID (or IDs) to this list.
data-voice (required) The voice to use for generating the Text-to-Speech audio. Publishers should use only a single voice and only from the supported voices list (TBD).
data-url The canonical URL of the web page to read aloud. The URL must be publicly accessible and free of any PII. The URL must be on a domain that was configured by Google and correlated with the specific API key.

When the parameter isn’t provided, the player uses the Canonical URL link tag of the current page. This is useful for reading aloud the content of the current page and only a single Read Aloud player is embedded in the page (no infinite scroll).

This value overrides it, and publishers are required to set it only in these cases:
  1. Other page - When the player is embedded in a different page than the one that its content should be read aloud. In this case, set this parameter to the canonical URL of the other page.
  2. Multiple players - When there are multiple players on the same page, see Multiple players (infinite scroll). In this case, set this parameter to the canonical URL of the article that the player should read aloud.
  3. Canonical URL tag is missing - When the Canonical URL link tag of the current page is missing (and cannot be added). In this case, set this parameter to the canonical URL of the page.
data-speakable Controls the contents to read aloud.

When present, uses text only from elements annotated with speakable markup, otherwise, Google analyzes the document automatically to choose the suitable text parts.
data-call-to-action-label The call to action label that is shown before the user pressed on play for the first time. Publishers can use it as a teaser to invite users to press the play button. If not present, "Listen to article" (localized) is shown. The string can be in any language.
data-intro The URL of the MP3 audio file which will be played before the player starts reading from the beginning. The intro can be used by publishers to create a unique opening for each playback. The intro is played whenever a listener starts playback from the beginning.
data-outro The URL of the MP3 audio file which will be played after the player ends reading. The outro can be used by publishers to create a unique ending for each playback.
data-ad-tag-url A complete VAST ad tag URL with parameters for playing pre-roll audio ads. When present, audio ads will be played before reading aloud page contents, after the user clicks on the play button for the first time. If not present, only page content will be played.
The ad tag URL must include the following parameters:
  • iu=[Ad unit code]
  • sz=1x1
  • ad_type=audio
  • output=vast
  • unviewed_position_start=1
  • env=instream
  • vad_type=linear

Usage

Include an amp-google-read-aloud-player on your AMP document:

<amp-google-read-aloud-player
  height="65"
  data-api-key="<YOUR_API_KEY>"
  data-tracking-ids="<YOUR_TRACKING_IDS>"
  data-voice="<YOUR_VOICE>"
></amp-google-read-aloud-player>

Validation

See amp-google-read-aloud-player rules in the AMP validator specification.

Требуется дополнительная помощь?

Вы читали этот документ десятки раз, но так и не нашли ответов на все свои вопросы? Возможно, другие люди столкнулись с такой же проблемой — обратитесь к ним на Stack Overflow.

Перейти на Stack Overflow
Нашли ошибку или недостающую функцию?

Проект AMP активно поощряет ваше участие и сотрудничество! Мы надеемся, что вы станете постоянным участником нашего открытого сообщества, но разовые вклады в работу над задачами, которые вам особенно интересны, также приветствуются.

Перейти на GitHub