Web analytics

Problems with AMP in web analytics of e-shops

I went through dozens of Google Analytics enhanced ecommerce , so we use product-oriented reporting (price, sales, categories, brandy, sku, variants). We behave similarly in advertising, where product data is the basis for product advertising, typically for super-powerful product dynamic remarketing and other forms of product advertising.

Documentation status?

Of course, the departure from the product perspective in AMP is not at the whim of e-shop owners, but because AMP throws sticks under their feet a bit.

In the AMP Gtag completely ignore the existence of ecommerce.

At the Official AMP support is planned.

Trick to measure Google analytics Enhanced ecommerce detail:

<amp-analytics type=“googleanalytics” >
<script type=“application/json” >
  "vars": {
    "account": "UA-XXXXX-Y"
  "triggers": {
    "trackPageview": {
      "on": "visible",
      "request": "pageview",
      "extraUrlParams": {
        "pa": "detail",
        "pr1id": "product_id",
        "pr1nm": "product_name",
        "pr1ca": "product_category",
        "pr1br": "product_brand",
        "pr1va": "product_variant",
        "pr1pr": "29.20"


But I couldn’t get the product details there.

config=" Manager-XXXXXX;Tag Manager.url=SOURCE_URL" 
data-credentials="include" >
<script type="application/json">
  "vars": {
    "type": "shoes",
    "color": "red"

Fortunately, there is a way to get at least part of the thing up and running. Namely, it is possible to help with this guide.
It combines the ability to send custom parameters with analytics data to GA.
And if the user selects these parameters cleverly and uses the Measurement Protocol, he can send product data to Google analytics.
It is quite easy to add a product detail to the website and the trigger should be used to send and add 1 piece of goods to the cart in the same way.
The limitation here is that the AMP page must be predefined dynamic variables like clienID, scroll, timestamp, etc.).
In this way it is possible to add individual data, the problem occurs again for impression lists (product display in the category), where due to the impossibility of scripts and javascript, it was necessary to solve everything after individual products. Which in the category of 30 products in practice will mean 3 x imports after 10 products and 30x script for measuring a specific click on the product category.

Code sample with GA EE detail:


But I couldn’t get the product details there.
And as you can see in the picture from GTM AMP, there is no setting option, just custom dimensions and metrics via number + value. The value can be taken from pre-created variables or from variables that I put in the page statically in the code.

In general, AMP GTM did not receive any updates until its inception in 2016. Yes, no one touched for 4 years. Where GTM refers to AMP implementations GTM refers to places where there is measurements for third parties fired on the page display. So as not to offend, via CSS selectors you can manually define clicks, element display, etc. but due to the impossibility of automating that process and creating a selector for each thing manually, it doesn’t make sense because it can’t be reasonably updated.

Another option would be to cough up AMP stuff and run GA AMP once to establish a cookie etc. and then send the rest as without using native tags, but build your measurment protocol straight.

Custom javascript in AMP

It could be argued that AMP already supports up to 150kb of its own javascript, but in reality there is a limit of 10kb per script. The pieces are run individually (they are in the sandbox), so they do not pass anything on. but in addition, there is a very limited selection of features that can be used in this script. As a bonus, scripts are run only if they are at a certain distance in the code from the active viewport. As a result, these custom scripts are virtually impossible to use for AMP analytics. These custom scripts were built to improve UX, typically button controls etc. and nothing more. The reason for this is that it is caching again. Since the pages are cached on the Google side, it cannot allow, from the point of view of security, anyone to touch the javascript on the content of cookies, the first page, where there is data to log in, etc.

What about other measurements? We don’t just have GA here.

Another point is that the data measured in AMP in general are unpairable with the data measured on the classic website and therefore their importance decreases in the perspective of website owners. Typically, cached content from Google is the time spent on the page.

This brings problems with the introduction of new processes for AB testing , measurement, advertising, which in most cases are problematic and requires more effort to start and the operation itself.

AB testing is possible, but again I have not seen it functional anywhere.

Product advertising in AMP on Facebook can be done again by sending individual pixels (non script version), as with GA EE, see the advanced documentation of measurement via image. Facebook pixel and with some functions it is necessary to look at it according to the data that is sent in individual requests.

In the presentation from AMPconf you can see both with the help of your own JS, that they managed to log in as well. Nice, but I didn’t see it anywhere again.

Where would I use AMP?

  1. Simple static website, presentation. Here the web will be fast, just the AMP version, from marketing all you need is a pageview and some thank you page for the form.
    You can also use a special format
  2. Blog. There is an advantage that WordPress has enough plugins to do everything for you. I don’t have it on my blog because I have too many improvements, special adjustments, etc. , but I’ve tested it a lot several times.
  3. Online magazine, news, content website. Here is the advantage of greater visibility in Google SERP, especially on mobile. That’s the content section of the List, and it probably works for them.

What about the e-shop in AMP?

Large companies often tried and then came back again, and many that in 2016-2017 were an example of successful implementation. In reality, it makes sense for me to be AMP only on the product detail, due to the speed and visibility on Google. And it can even be measured (detail) Of course, the problem will be that if the user clicks on the page and encounters a slow site, what looks totally different. (Update from PWA, for example.that have better ecommerce support. Even PWA can then be supplemented with AMP and in synergy use a faster first load. The result will be that in the finals he will take care of the standard website, PWA and AMP, ie three different versions of the same and you will implement each change 3 times differently and it will take 3x more time + bonus time to be the same and work really the same. You will evaluate 2-3 different measurements of the same, measured in at least two ways, so it will not be pairable. Technologies created for AMP will once (not immediately, but within years) be rewritten into W3 standards and this technology will disappear (purely personal opinion). I’d rather have one well-tuned site than more versions of sites made in half.

It is also possible to look at it from the point of view that it is not necessary / necessary to have the same (1: 1) data on the e-shop and in the AMP version. Just take it more as a separate analytics. Which was rightly pointed out to me by Pavel Jašek .

What should happen to me to recommend AMP for ecommerce?

  1. Support enhanced ecommerce in full as in a normal website.
  2. Documentation for GA EE AMP
  3. Update GTM AMP and give it basic settings.

There is nothing about tons of JS and the possibilities to change something just to use it.


There are AMP emails and they believe it could spread and that it makes sense.

In retrospect, I found other articles in English on the same topic ”

Do you have a different opinion?

I will be happy if you mislead me on this topic and tell me that you have only figured it out, I don’t know how to do it. Send me an email, write to me on social networks.

I will be pleased, I will be happy to mention you and add full credit for your discoveries or even links to solving the pitfalls of AMP.

The article was created in response to an discussions on FB under this post in the group. And since I have been devoting myself to this topic for a long time, it was necessary to consolidate and write it down a bit.

A little old discussion from FB