How To Track Accelerated Mobile Pages With GA4

What is AMP and why use it?

AMP was created by Google in 2015 as a way to improve the user experience of mobile web content. AMP pages are designed to load instantly, without any delays or interruptions, by using a simplified version of HTML, CSS, and JavaScript. AMP pages also use a custom element called <amp-analytics> that enables the measurement of user interactions on the page.

AMP has several benefits for publishers and advertisers who want to reach more users on mobile devices. Some of these benefits are:

Faster loading time: AMP pages can load up to 10 times faster than regular web pages, according to Google.

Better SEO: AMP pages can help improve the ranking and visibility of your content on search engines, as they follow the best practices for mobile-friendly websites.

More engagement: AMP pages can provide a better user experience, as they are more responsive, interactive, and accessible than regular web pages.

More revenue: AMP pages can help increase the conversion rate and revenue of your website, as they can attract more users who are interested in your content.


How to Measure AMP Pages with Google Analytics 4

Accelerated Mobile Pages (AMP) is a platform for building web pages that render fast and load in any browser. AMP pages are similar to HTML pages, but they use a different set of tags and components to achieve optimal performance. AMP pages are also compatible with Google Analytics, which is a powerful tool for measuring and analyzing user behavior on your website.

To measure AMP pages with Google Analytics 4 (GA4), you need to do the following steps:

Add the <amp-analytics> tag to your AMP page. This tag is an extended AMP component that is explicitly enabled as a custom element in a script tag. You also need to specify your Google Analytics property ID in the config parameter of the tag.

Set up a custom parameter named “ampHost” in your GA4 property. This parameter will track where the AMP page is served, either on your domain or via Google viewers.

Relaunch your AMP page for the changes to take effect.

The <amp-analytics> tag looks like this:

<script async custom-element="amp-analytics" src="[4]("></script>

<amp-analytics type="gtag" data-credentials="include">

<script type="application/json">


"vars" : {

"gtag_id": "<GA_MEASUREMENT_ID>",

"config" : {


"groups": "default"







The config parameter looks like this:



"groups": "default"



The GA_MEASUREMENT_ID is your Google Analytics property ID.

The groups parameter specifies which GA4 property ID you want to use for measuring the data from the AMP page.

What are the requirements to use GA4 in AMP?

In order to utilize Analytics on AMP pages, it is necessary to provide information on how Analytics collects and utilizes data, as well as give users the option to opt out of Analytics. This can be achieved by including a link to Google's privacy and terms, which contains a link to the Analytics opt-out page. Additionally, make sure to implement the AMP Analytics tag on your mobile pages. For further guidance, refer to the AMP Analytics spec available on Google Developers.

What data can you measure with GA4?

With GA4, you can measure various types of data from your AMP page, such as:

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

However, there are some limitations and considerations when using GA4 for measuring AMP pages:

You cannot use consent mode settings or dynamic configuration (such as Google Signals or Enhanced Conversions) on your AMP page.

You cannot track ecommerce events or transactions on your AMP page.

How does GA4 handle IP addresses?

In GA4, IP addresses are not logged or stored by default, so you do not need to worry about IP masking or anonymization when measuring your AMP page traffic. However, if you want to track where your users come from geographically or identify them based on their IP addresses, you may need to use other methods such as third-party services or custom parameters.

Evaluating cache versus non-cache

If you wish to delve deeper into the dynamics of user engagement with AMP pages on cache as opposed to your own domain, you can utilize the provided instructions to relay this data to Analytics through a customized parameter.

  1. Add the following config to the Analytics tag on your AMP pages:vars: {
    'ampHost': '${ampdocHost}'
  2. Register the ampHost custom parameter in Google Analytics 4 and relaunch your AMP page.

At present, the capabilities of Analytics for AMP are more restricted compared to standard Analytics. However, additional AMP capabilities will be gradually incorporated in the future.

Need help with GA4?

Contact us at or fill out the form at the Contact Us page


Leave a Reply

Your email address will not be published. Required fields are marked *