Measuring user journeys across the AMP Cache and your website

“If you can’t measure it, you can’t manage it.” — Peter Drucker

As users demand better privacy controls, browser vendors have started responding with defaults that partition cookies. This means traditional approaches of relying on third-party cookies for measurement won’t work going forward.

AMP pages are often served from an AMP Cache and the ability to maintain a session by using a third-party cookie allows publishers to remember user settings and preferences even when users move between the AMP cache domain and the publisher’s domain.

AMP Linker

AMP Linker is a new feature in AMP that helps keep user session in sync. It works by decorating outgoing links from AMP cache with params such as AMP Client ID in a URL parameter. On the receiving side, your analytics provider consumes the parameter and writes it down as a first-party cookie.

The decorated link will look something like

https://destination.com/checkout?_foo=1*19eaxqc*bar*V2dj…eHZKYg

linker.png


Enable AMP Linker

AMP Linker works by including a config for your analytics provider. For instance, if you’re using Google Analytics you’d include something as follows:

<amp-analytics type=”googleanalytics”>
 <script type=”application/json”>
   {
     “linkers”: {
       ”enabled”: true
     }
   }
</script>
</amp-analytics>

If you already use the Google AMP Client ID API with Google Analytics, no additional tagging is required to take advantage of AMP Linker capability.

If you are an analytics provider, we welcome you to reach out to us to take advantage of AMP Linker.

Looking ahead

We’re hard at work to support non-traditional, yet important, user journeys where a user goes from non-AMP pages to AMP pages. Keep an eye out on our repo on Github for updates regarding those.

Happy measuring!

Posted by Jeff Jose, Product Manager, AMP Project at Google

Measuring user journeys across the AMP Cache and your website