AMP pages: how to track user actions between domain and cache

Put us to the test
Put us to the test!
Analyze your site
Select the database

The management of pages and user interactions in AMP pages served with cache has long been one of the critical points of this framework, one of the most perplexing factors in site owners. From the official blog of the project comes a practical guide to be able to solve the problem of tracking and, in particular, to monitor the user’s actions between the original pages and those served with AMP cache.

User state and AMP cache

The article by Ben Morss, Developer Advocate at Google, starts precisely from an aspect relevant to sites that use AMP and that often may appear problematic: if a user visits a page served on a AMP cache and then returns to the original domain, it may not be immediate to recognize that it is the same person.

A concrete example for this situation concerns eCommerce: wanting to reach users better, a site decides to create product pages with AMP and “when web spiders like Google and Bing discover these AMP pages, it stores them in AMP caches and shows them to users in an iframe that passes through a site like google.com or bing.com, publishing the page from an AMP cache, like cdn.ampproject.org or bing-amp.com“.

How to track the actions of users

So far everything in the norm: but what happens if a user discovers the page on a AMP cache, adds products to the cart and later in the day visits the site again by typing the normal domain? Will those products still be in your shopping cart or will you find it empty?

AMP cache, how to avoid problems

As we know, an immediate solution to this problem is already thanks to the Signed Exchange, the certification that allows you to show the URL origin of the site also for pages s