Accelerated Mobile Pages (AMP) is an open source page format for the mobile web that makes it possible for your pages to render almost instantly on mobile devices. AMP pages are similar to HTML pages and load in any browser. However, you cannot use gtag.js on Accelerated Mobile Pages, so a different Analytics tag is provided specifically for AMP.
User identifiers are randomly generated and stored either in localStorage or cookies. The user identifier is reset when the user clears cookies and local storage. In Google Analytics 4, IP masking is not necessary since IP addresses are not logged or stored, so by default the AMP tag never logs IP addresses.
AMP Analytics supports the Analytics opt-out. If the opt-out is installed, Analytics data collection is disabled.
Accelerated Mobile Pages allow users to engage with content from a single publisher on multiple sites during the same session.
To use Analytics on AMP pages, you must:
- Disclose how Analytics collects and uses data, and offer users the opportunity to opt-out of Analytics. You can do this by linking to the Google privacy and terms, which includes a link to the Analytics opt-out page.
- Use the AMP Analytics tag on your mobile pages. Refer to the AMP Analytics spec on Google Developers.
AMP Analytics allows you to collect the following data:
- Page data: Domain, path, page title
- User data: client ID, timezone
- Browsing data: referrer, unique page view ID
- Browser data: screen height, screen width, user agent
- Interaction data: page height and page width
- Event data
The following is not supported:
- Managing Consent Mode settings
- Dynamic, UI-driven configuration (Google Signals, Enhanced Conversions)
- ecommerce events
The Google AMP Client ID API was recently launched to improve user analysis across pages served on your domain and AMP pages served within Google viewers. In addition to serving super-fast AMP content on your own domain, AMP content will also be served directly via Google viewers. However, if you don’t use the Google AMP Client ID API, having pages served in at least two contexts—within Google viewers and on your own site—will result in multiple identities for a single user that engages with your content across these two (or more) touch points.
Cache vs. non-cache analysis
If you’d like a deeper understanding of how users interact with AMP pages on cache vs. your own domain, then you can use the following instructions to send that data to Analytics via a custom parameter.
- Add the following config to the Analytics tag on your AMP pages:
- Register the
ampHostcustom parameter in Google Analytics 4 and relaunch your AMP page.