[UA] Measurement of Accelerated Mobile Pages (AMP) [Legacy]

Accelerated Mobile Pages require a different Analytics tag.
You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

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 analytics.js on Accelerated Mobile Pages, so a different Analytics tag is provided specifically for AMP.

Analytics data collection is implemented as a layer on top of the Measurement Protocol. 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. The AMP tag supports IP truncation as described in IP masking in Analytics. Data from AMP documents is always IP masked.

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. Learn more about session-based metrics collected from Accelerated Mobile Pages.

Requirements

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.

Capabilities and limitations

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
Analytics for AMP currently has more limited capabilities than standard Analytics; AMP capabilities will be added over time.

Additional considerations

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

  1. Add a new custom dimension via the Analytics interface. Make it a hit level dimension and note the index number.
  2. Add the following config to the Analytics tag on your AMP pages:
    
      extraUrlParams: {
      'cd<index 1="" from="" step="">': '${ampdocHost}'
    }
    
    EX: So if the index is 5 then the config will be:
    extraUrlParams: {
      'cd5': '${ampdocHost}'
    }
    
  3. Relaunch your AMP pages and you'll see the hostname flowing into the new custom dimension.
  4. After you relaunch your AMP pages, you can set up a Custom Report with the new custom dimension, or access the custom dimension in any of your normal reporting processes.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Google apps
Main menu