Enable experimental features
Important: this documentation is not applicable to your currently selected format email!
AMP experimental components are released features not yet ready for wide use, so they are protected by an experimental status.
Developers and users can opt-in to using these features before they are fully released. But they should be used with caution, as they may contain bugs or have unexpected side effects.
The following is a list of components that are currently in experimental status and are ready to be tested by developers for first user feedback:
- amp-accordion-v1.0
- amp-action-macro-v0.1
- amp-audio-v0.1
- amp-audio-v1.0
- amp-base-carousel-v0.1
- amp-base-carousel-v1.0
- amp-dailymotion-v0.1
- amp-dailymotion-v1.0
- amp-date-countdown-v1.0
- amp-embedly-card-v1.0
- amp-facebook-v1.0
- amp-fit-text-v1.0
- amp-iframe-v1.0
- amp-image-slider-v1.0
- amp-inline-gallery-v1.0
- amp-instagram-v1.0
- amp-lightbox-gallery-v1.0
- amp-lightbox-v1.0
- amp-mega-menu-v0.1
- amp-next-page-v0.1
- amp-selector-v1.0
- amp-sidebar-v0.2
- amp-sidebar-v1.0
- amp-social-share-v1.0
- amp-soundcloud-v1.0
- amp-story-panning-media-v0.1
- amp-stream-gallery-v0.1
- amp-stream-gallery-v1.0
- amp-tiktok-v0.1
- amp-timeago-v1.0
- amp-truncate-text-v0.1
- amp-twitter-v1.0
- amp-video-v1.0
- amp-wordpress-embed-v1.0
- amp-youtube-v1.0
Opt into the AMP Beta Channel
The AMP Beta Channel is a way to opt a browser into using a newer version of the AMP JS libraries.
The AMP Beta Channel release may be less stable and it may contain features not available to all users. Opt into this option if you'd like to help test new versions of AMP, report bugs or build documents that require a new feature that is not yet available to everyone.
Opting into Beta Channel is great to:
- test and play with new features not yet available to all users.
- use in quality assurance (QA) to ensure that your site is compatible with the next version of AMP.
If you find an issue that appears to only occur in the Beta Channel version of AMP, file an issue with a description of the problem. Always include a URL to a page that reproduces the issue.
To opt your browser into the AMP Beta Channel, go to the AMP experiments page and activate the "AMP Beta Channel" experiment. To get notified about important/breaking changes about AMP, subscribe to the amphtml-announce mailing list.
Enable an experimental component
Served from cdn.ampproject.org
For content served from https://*.cdn.ampproject.org
,
go to /experiments.html
on a Google AMP Cache subdomain and enable (or disable) any experimental component by toggling them on (or off).
For example, to enable experiments on cached AMP pages whose source origin is www.example.com
, go to www-example-com.cdn.ampproject.org/experiments.html
.
Experiment opt-ins are saved to localStorage
and only enables the experiment on AMP pages served from the current domain.
Served from other domains
For content served from non-CDN domains, experiments can be toggled in the devtools console using:
AMP.toggleExperiment('experiment')
Any AMP file that includes experimental features will fail AMP validation. Remove these experimental components for production-ready AMP documents.
Enable an experiment for a particular document
Document can choose to opt in a certain experiments. To do that, place a meta tag of the amp-experiments-opt-in
name in the head of the HTML document before your AMP script (https://cdn.ampproject.org/v0.js
). Its content value is a comma-separated string of experiment IDs to opt in.
<head>
...
<meta name="amp-experiments-opt-in" content="experiment-a,experiment-b">
<!-- The meta tag needs to be placed before the AMP runtime script.-->
<script async src="https://cdn.ampproject.org/v0.js"></script>
...
</head>
By doing so, the specified experiments will be enabled for all visitors of the document. However, not all experiments allow document-level opt-in. For a full list of allowlisted experiments, see the allow-doc-opt-in
attribute in the project's prod-config.json
file. Note that document opt-in can be overridden by user opt-out.
Origin trials
Origin trials enable developers to use an experimental feature in production and provide essential feedback.
Traditionally, a feature in experimental mode can be used in development, but cannot be pushed to production. With Origin trials, interested developers can opt-in to a test an experimental feature in production, with the following expectations:
- The test is for a limited time.
- The feature will likely undergo some changes after origin trials.
Origin trials present an opportunity to implement and benefit from a new feature before it’s fully live. The feature will live on the developer's site, rather than guarded by an experiment, and feedback can directly influence the direction of the feature.
Enable an origin trial
Include the following <meta>
tag within the <head>
tag on each page that uses the origin trial experiment:
<meta name="amp-experiment-token" content="{copy your token here}">
"amp-experiment-token"
is the literal string, "amp-experiment-token"
. Not the token itself (which goes into the content attribute), or the name of the experiment.