track amp page traffic google analytics 4

Ever since AMP was introduced to decrease the page loading speed, publishers became crazy to integrate this technology.

Although it limits the number of elements you can keep on a webpage, it definitely improves the ranking.

The reason is, when you are using this technology, which means making your page AMP enabled, then Google stores a cache version of your webpage in its server.

And when the Google Bot queried the particular page, it directly served from Google’s cache resulting in an excellent page load time.

This way Google bot indexes more and more of your website’s content as the ping latency in between your content and Google bot became quite low.

Plus it helps Google to save its computing time. You know, Google has to index billions of web pages.

So, AMP was a revolutionary technology introduced by Google that benefit both the publishers as well Google.

Things were great so far till 2020 then Google introduced Google Analytics 4.

And it complicates the process of tracking AMP pages.

Publishers using AMP technology find it difficult how to track their website traffic via Google Analytics 4.

In fact, starting 1 July 2023, Universal Analytics (the predecessor of GA4) will stop processing data.

While the deadline to migrate from Universal Analytics to Google Analytics 4 remains a few days, GA4 now brings support to track Accelerated Mobile Pages (AMP).

Many webmasters were demanding this feature since Google planned to sunset Universal Analytics.

Google Analytics team gives this information to the webmasters via a Tweet. In the tweet, they wrote: “AMP is now supported in Google Analytics 4, ensuring that publishers using AMP are able to measure their website performance with GA4”.

Do note that you can’t track AMP with gtag.js as it requires a different Analytics tag called AMP Analytics.

Now, while AMP Analytics has many capabilities, it is limited in comparison to standard analytics. However, Google said they will add more capabilities over time.

What are the different types of data AMP Analytics can collect?

Below are the different types of data that AMP analytics can collect:

  1. User Data: client ID, timezone
  2. Page Data: Domain, path, page title
  3. Browsing Data: referrer, unique page view ID
  4. Event Data
  5. Browser Data: user agent, screen height, screen width
  6. Interaction Data: page height, page width

Do note that, Google Analytics 4 doesn’t store IP Address hence, AMP Analytics also doesn’t store IP address data.

So, if you are one such publisher who is finding it difficult to track their AMP pages in GA4, then this guide is for you.

Steps to Track AMP in Google Analytics 4 (GA4)

Now, as Google Analytics 4 supports tracking the AMP pages, all you need is the AMP analytics code and your GA4 Measurement ID.

I will provide you the AMP analytics code below, but first let me explain to you how to find your GA4 Measurement ID.

You can find your GA4 Measurement ID by visiting Admin > Setup Assistant

After opening the Setup assistant, click on the right arrow button > that is present next to the not started text in the Data collection selection.

Select Manage Data Streams and then click on the arrow present aside to your GA4 properly. As shown in the screenshot below.

Now, copy your Measurement ID as shown in the screenshot below.

So, now you have finded your GA4 measurement ID, all you need is the AMP analytics code now which I have mentioned below.

<amp-analytics type="googleanalytics" config="https://amp.analytics-debugger.com/ga4.json" data-credentials="include">
<script type="application/json">
{
    "vars": {
                "GA4_MEASUREMENT_ID": "G-XXXXXXXXXX",
                "GA4_ENDPOINT_HOSTNAME": "www.google-analytics.com",
                "DEFAULT_PAGEVIEW_ENABLED": true,    
                "GOOGLE_CONSENT_ENABLED": false,
                "WEBVITALS_TRACKING": false,
                "PERFORMANCE_TIMING_TRACKING": false
    }
}
</script>
</amp-analytics>

Simply copy and paste the above code in the head section of your website.

Replace the GA4 measurement ID with your own.

Save it and you are good to track your AMP page traffic right in your GA4 account.

That is it for the article. If you have any doubt or suggestion, feel free to drop it in the comments down below.

Read also: How to Integrate Google Adsense and Google Analytics 4 Data?

I am a Search Engine Optimization Specialist taming the elusive search engine algorithms for over 6 years now. I have created some pretty darn impressive SEO projects. While I'm not busy dominating the...

Leave a comment

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