How to Track AMP Web Stories in GA4 Without Using a Plugin

Issues on How to track AMP on GA4 without Plugin?

Hi All, 

I am facing an issue tracking AMP web stories in GA4. The thing is, we have created AMP web stories manually via AMP codes and all. We didn’t use any plugins for these. 

What has happened now is that I have integrated the same tag manager code that we used for other pages too. But the thing is, it tracks only from SERP and not on Google Dicover. Now it is showing web stories are invalid while I’m checking the AMP test on Google. Because if we want to track Google Discover, we have to put the specific AMP tag manager code in the webstories, and then only the webstories will be valid. At the same time, we are not able to integrate with GA4, because there is no option for the GA4 option; only the UA option is there in Tag Manager (AMP Integeration).  

So someone can help me resolve this issue. How to track webstories on GA4 and, at the same time, webstories need to be valid. Thank you in advance. 

The short answer is:

How to track AMP Web Stories in GA4 without using a plugin?

You need to implement the tag with a specific configuration to manually send data directly to GA4โ€™s Measurement Protocol, bypassing the AMP Tag Manager container for reporting, and then, crucially, you should use server-side tagging with a tool like Stape or Google Cloud Platform to unify sessions and enrich the data.

The core problem is that the official Google Tag Manager AMP container currently doesn’t support the GA4 Configuration tag, meaning you can’t use it to send data to your G-ID and maintain a valid AMP setup for Discover.

Therefore, you must use a separate tag configured to send hits to a server-side endpoint, which is then responsible for forwarding the data to GA4, while making sure to pass the clientId for session unification.

The long answer is:

The conflict you’re experiencing stems from the fact that Google Tag Manager for AMP was designed primarily for Universal Analytics (UA), and while it can still be used, its support for native GA4 tracking is limited, leading to the validation issues you’re seeing when trying to ensure you’re covered for Google Discover.

The standard practice for non-plugin GA4 tracking on AMP is to use the component, but to get it to work correctly for session unification (tracking a user as one journey from the Google Discover/SERP cache to your website) and be valid, a server-side tagging approach is your best, most robust, and most cost-effective long-term solution.

You should first ensure your tag is configured in your Web Story code to send data to a custom endpoint on your domain, which is the URL of your server-side Tag Manager container.

Inside the configuration, you must include the clientId as a variable, which is the key to cross-platform tracking, and specify the events you want to track, like page_view.

The clientId value in the AMP context is typically generated by the Google AMP Client ID API, which is critical for stitching together the user’s session from the Google-cached version to your canonical domain, preventing two separate sessions.

Next, you set up a server-side Tag Manager container, which acts as an intermediary.

The data from your Web Stories hits this server-side container first.

In this container, you deploy a GA4 Client, which receives the incoming data, and a GA4 Tag, which then forwards the data to your actual GA4 property.

This is where the magic happens: the server-side tag can read the clientId passed from the tag and use it to set the correct User ID in the GA4 hit, ensuring accurate session unification.

Using a solution like Stape to host your server-side container offers a cheaper and simpler alternative to setting up your own infrastructure on a platform like Google Cloud Platform.

The entire process using Google AMP Client ID API, Google Analytics Data API (for potential data manipulation or custom reporting later, though not strictly necessary for the core tracking), and a server-side GTM with Stape is an excellent and cheap solution because it maintains AMP validation, correctly unifies the user’s session across domains using the clientId, provides full control over the data before it hits GA4 (for things like consent or data enrichment), and avoids the licensing costs associated with full-service plugins while being more reliable than a purely client-side custom GA4 configuration.

Once this is set up, you will see rich data for all user interactions, including those from Google Discover, and your Web Stories will remain valid.

About The Author