Clear search
Close search
Google apps
Main menu

Implement tracking pixels

A tracking pixel is code used to track impressions by making a server call and returning a transparent 1x1 pixel. You typically get a tracking pixel from a third party, in the form of a URL.

You can implement tracking pixels in Google Play Newsstand for either an entire edition or for individual articles. The tracking pixel URL is called when user starts reading the first page of an article or post.

Edition-level tracking pixels

To use the same tracking pixel for an entire edition, visit Google Play Newsstand Producer and follow these steps:

  1. Go to Edition Settings.
  2. Under Collect usage info, expand Trackers.
  3. Enter the tracking pixel URL. It must begin with https:// and can include variables.

Any tracking pixel URLs you specify will be automatically added to each article or page in the edition.

Tracking pixels for individual articles

Tracking pixels can be included in the content of individual articles. Include the code directly within the article source, making sure to use an HTTPS URL. Currently, only the <amp-pixel> tag is supported for this purpose. Note that only the below variable substitutions can be used.

Using Newsstand Pixel Tracker for comScore Traffic Crediting

Below is the URL structure that should be used for comScore Traffic Crediting. Replace Publisher_ID with your own comScore "Client ID". If you don't know your comScore "Client ID", please contact your comScore representative. If you are already using the comscorekw parameter for other purposes, please append "_PlayNewsstand" to the existing keyword populated in the comscorekw parameter.

Use the above URL and follow the instructions under "Edition-level tracking pixels" to enable comScore Traffic Crediting.

Variable substitutions

Tracking pixel URLs can include variables which will be substituted with the appropriate data when the call is made. The following variable substitutions are supported:

Variable Details
AMPDOC_HOST The AMP document's URL host.
AMPDOC_URL The AMP document's URL.

URL with variable:
Might make a request to:
CANONICAL_HOST The canonical URL's host of the current document.

URL with variable:
Might make a request to:
CANONICAL_PATH The canonical URL's path of the current document.

URL with variable:
Might make a request to:
CANONICAL_URL The canonical URL of the current document.

URL with variable:
Might make a request to:
CLIENT_ID A per document-source-origin (the origin of the website where you publish your AMP doc) and user identifier. The CLIENT_ID will be the same for the same user if they visit again within one year. It should behave roughly similar to a cookie storing a session ID for one year. If the document is not served through the AMP Cache, the CLIENT_ID will be replaced with a cookie of the specified name. If the cookie is not present, the empty string will be returned.
DOCUMENT_REFERRER The current document's referrer.
PAGE_VIEW_ID A string that is intended to be random and likely to be unique per URL, user, and day.
RANDOM A random number between 0 (inclusive) and 1 (exclusive).
TIMESTAMP The timestamp for when the pixel tracking request is created, in Epoch time (the current number of seconds that have elapsed since 1970).
TITLE The title of the current document.
Was this article helpful?
How can we improve it?