Search
Clear search
Close search
Google apps
Main menu

Set up Google AMP Client ID API

Google’s AMP Client ID API is a service that allows you to uniquely identify and analyze a user’s experience across AMP and non-AMP content. It is available for anyone to use and is supported by optional tagging changes to your Google Analytics configuration.

About the AMP Client ID API

Google’s AMP Client ID API lets you uniquely identify users who engage with your content on AMP and non-AMP pages. If you opt-in, Google Analytics uses the AMP Client ID to determine that multiple site events belong to the same user when those users visit AMP pages via a Google viewer. Associating events and users provides features like user counts and session-based metrics.

Use the API to retrieve user IDs associated with AMP-page activity and consolidate those with your own representations of those same users on your non-AMP pages. The consolidated information provides a more accurate picture of user journeys and use of your service.

The API also offers per-publisher tracking expiry and per-publisher user opt-out of tracking.

At this time, the API supports connecting back to AMP pages that were viewed via a google.com viewer. Support for other Google country-code top-level domain variants such as google.de, is coming soon.

How the AMP Client ID API affects your data

As users who are uniquely identified across AMP and non-AMP pages return to your site, user- and session-related metrics more accurately reflect their behavior. For example, metrics like Session Duration, Bounce Rate, and Pages per Session will change positively to reflect a more accurate representation of behavior across AMP experiences.

In addition, as these users return to your AMP pages, their IDs will be reset. This will happen once for every user who comes to your AMP pages after opting into this solution. At that time they will be represented as a new user. Depending on the frequency with which users visit your site(s), this could cause a noticeable, temporary fluctuation in your New Users metric and related reporting.

Setup

By opting into usage of this service by way of encoding the prerequisite tagging changes shown below, you agree that you have read and acknowledge the Google AMP Client ID API Policy, and have implemented any requirements therein of this service in conjunction with any Google Analytics property with which it is used.

You opt into this service by making two code changes, one in your AMP page configuration file, and another in your Google Analytics javascript file.

Please also note that launching AMP pages is much the same as launching any other website, and that you should be mindful of subdomain usage and referral exclusion where needed and appropriate.

Opt in on your AMP pages

Include the following code in the <head> of your AMP page:

<meta name="amp-google-client-id-api" content="googleanalytics">

Opt in on your non-AMP pages

Google Tag Manager

The following steps should be completed on your existing published tag container(s).

  1. Navigate to Tag Configuration > Fields to Set.
  2. Set useAmpClientId to true.
  3. Save the new tag configuration.
  4. Submit the tag.
  5. Publish the container.

analytics.js

Include the following in your Analytics tracking code:

ga('create', 'UA-XXXXX-Y', 'auto', {'useAmpClientId': true});

Was this article helpful?
How can we improve it?
Google Analytics training and support resources

Check out our comprehensive list to learn more about Analytics solutions.