DCR Static Google AMP Cloud API

From Engineering Client Portal

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR breadcrumbArrow.png DCR Static Google AMP Cloud API

This guide will show you how to enable Digital Content Ratings (DCR) Static measurement on Google AMP.

Import AMP Analytics Javascript Library

If you have not already, you will need to import the AMP JS library in the <head> of your webpage in order to make an AMP page:

<script async src="https://cdn.ampproject.org/v0.js"></script>


Next, please ensure that the following line is included in the <head> of the webpage:

<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

Note: AMP pages require all traffic to be using HTTPS, including the webpage itself

Specify the Analytics Provider

DCR measurement can be added to your AMP pages through the AMP-Analytics element:

<amp-analytics type="nielsen">
    <!-- Add Nielsen DCR Tags here -->
</amp-analytics>

For more information on the Analytics type, you can refer to the Analytics vendors section of Google's AMP Developer Documentation.

Configure Metadata

You will need to match the metadata fields on your AMP page with those of your non-AMP page.

Metadata Keys

The Nielsen reserved keys are:

Key Description Example Value Required
apid unique ID assigned by Nielsen XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
apv current version of the Nielsen implementation 1.0
apn name of the website My AMP Website
section section of the site to be measured Entertainment
segA custom segment to be used to break out reporting Music
segB custom segment to be used to break out reporting News
segC Reserved custom segment for Google AMP Google AMP

The values passed through the Nielsen keys will determine the breakouts you will see in reporting. If you decide not to use custom segments A and B, then you do not need to pass a value in these keys. It is suggested you use the same segments used in non-AMP pages.

Note: The value for the 'apid' you pass for AMP measurement should not include the 'P' prefix that is otherwise present on other SDK-related implementations

Metadata for Reporting

You can reference the table to determine how the metadata you pass is used to define your reporting structure:

Reporting Level Key Description
Brand/Sub-brand apid brand and sub-brand are determined by assigned App ID passed during initialization
Section section section or category for the AMP page
Custom Segment A segA available segment for custom reporting. Custom segments will roll into the sub-brand
Custom Segment B segB available segment for custom reporting. Custom segments will roll into the sub-brand
Custom Segment C segC Custom segment C is reserved for reporting ‘Google AMP’. The Google AMP custom segment will be available under sub-brand and will include the total metrics for all your AMP pages

If you would like your AMP pages to report into the same reporting structure as your website, we recommend passing the same dynamic metadata in Section, Custom Segment A, and Custom Segment B as you are on your website. This way your AMP pageviews contribute to those aggregations.

Aggregation Limits

There are limits on the number of unique values that can be aggregated on in reporting. The specific limitations by key are:

Key Aggregation Limit
section maximum of 25 unique values (section <= 25)
segA total sum of segA, segB, and segC must be a maximum of 24 unique values (segA + segB + segC <= 24)
segB total sum of segA, segB, and segC must be a maximum of 24 unique values (segA + segB + segC <= 24)

Example Implementation

The below is an example implementation of Nielsen measurement on an AMP page:

<amp-analytics type="nielsen">
    <script type="application/json">
    {
      "vars": {
        "apid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "apv": "1.0",
        "apn": "My AMP Website",
        "section": "Entertainment",
        "segA": "Music",
        "segB": "News",
        "segC": "Google AMP"
      }
    }
    </script>
</amp-analytics>

You can find more information about dynamic variables on Google's AMP documentation.

Note: append #development=1 at the end of your URL to see AMP debug logs in the console. This can be helpful when troubleshooting

Privacy Policy

Nielsen uses cookies for browser measurement. In order to comply with our privacy restrictions, we ask that you make a link to our Digital Privacy Policy available on your site. You can find our privacy policy here: https://priv-policy.imrworldwide.com/priv/browser/us/en/optout.html