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:
|
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:
|
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