Implement tracking pixels

A tracking pixel is code you can use 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 News 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 News Producer and follow these steps:

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

Any tracking pixel URLs you specify are 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: Only variable substitutions in the following sections can be used.

Using News Pixel Tracker for comScore traffic crediting

Use the URL structure below for comScore traffic crediting. Replace "Publisher_ID" with your own comScore Client ID. If you don't know your comScore Client ID, contact your comScore representative. If you're already using the comscorekw parameter for other purposes, add "_PlayNewsstand" to the existing keyword populated in the comscorekw parameter.

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

Variable substitutions

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

Variable Details
AMPDOC_HOST The Accelerated Mobile Pages (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 is replaced with a cookie of the specified name. If the cookie is missing, the empty string is returned.
DOCUMENT_REFERRER The current document's referrer.
PAGE_VIEW_ID A string that's 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 helpful?
How can we improve it?