DCR Static Google AMP Cloud API: Difference between revisions

From Engineering Client Portal

 
(12 intermediate revisions by 2 users not shown)
Line 5: Line 5:


== Import AMP Analytics Javascript Library ==
== Import AMP Analytics Javascript Library ==
Please ensure that the following line is included in the <code><head></code> of the webpage:
If you have not already, you will need to import the AMP JS library in the <code><head></code> of your webpage in order to make an AMP page:
<syntaxhighlight lang="html"><script async src="https://cdn.ampproject.org/v0.js"></script></syntaxhighlight>
 
 
Next, please ensure that the following line is included in the <code><head></code> of the webpage:
<syntaxhighlight lang="html"><script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script></syntaxhighlight>
<syntaxhighlight lang="html"><script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script></syntaxhighlight>
<blockquote>'''Note''': AMP pages require all traffic to be using HTTPS, including the webpage itself</blockquote>


== Specify the Analytics Provider ==
== Specify the Analytics Provider ==
Line 14: Line 19:
</amp-analytics></syntaxhighlight>
</amp-analytics></syntaxhighlight>


For more information on the Analytics type, you can refer to the [https://www.ampproject.org/docs/guides/analytics/analytics-vendors| Analytics vendors] section of Google's AMP Developer Documentation.
For more information on the Analytics type, you can refer to the [https://www.ampproject.org/docs/guides/analytics/analytics-vendors Analytics vendors] section of Google's AMP Developer Documentation.


== Configure Metadata ==
== Configure Metadata ==
Line 28: Line 33:
|-
|-
| apv || current version of the Nielsen implementation || <code>1.0</code> || ✓
| apv || current version of the Nielsen implementation || <code>1.0</code> || ✓
|-
| apn || name of the website || <code>My AMP Website</code> ||
|-
|-
| section || section of the site to be measured || <code>Entertainment</code> || ✓
| section || section of the site to be measured || <code>Entertainment</code> || ✓
Line 35: Line 42:
| segB || custom segment to be used to break out reporting || <code>News</code> ||
| segB || custom segment to be used to break out reporting || <code>News</code> ||
|-
|-
| segC || custom segment to be used to break out reporting || <code>Branded_Content</code> ||
| segC || Reserved custom segment for Google AMP || <code>Google AMP</code> ||
|}
|}


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, B, and C, 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.
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.
 
<blockquote>'''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</blockquote>


=== Metadata for Reporting ===
=== Metadata for Reporting ===
Line 55: Line 62:
| Custom Segment B || segB || 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 || 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
|}
|}


Line 71: Line 78:
|-
|-
| segB || 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)
|-
| segC || total sum of segA, segB, and segC must be a maximum of 24 unique values (segA + segB + segC <= 24)
|}
|}


Line 83: Line 88:
         "apid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
         "apid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
         "apv": "1.0",
         "apv": "1.0",
        "apn": "My AMP Website",
         "section": "Entertainment",
         "section": "Entertainment",
         "segA": "Music",
         "segA": "Music",
         "segB": "News",
         "segB": "News",
         "segC": "Branded_Content"
         "segC": "Google AMP"
       }
       }
     }
     }
     </script>
     </script>
</amp-analytics></syntaxhighlight>
</amp-analytics></syntaxhighlight>
You can find more information about dynamic variables on [https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#page-and-content Google's AMP documentation].
<blockquote>'''Note''': append <code>#development=1</code> at the end of your URL to see AMP debug logs in the console. This can be helpful when troubleshooting</blockquote>


== Privacy Policy ==
== 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:  
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:  
http://www.nielsen.com/digitalprivacy#choice
https://priv-policy.imrworldwide.com/priv/browser/us/en/optout.html

Latest revision as of 20:57, 23 February 2023

Engineering Portal / Digital / DCR & DTVR / 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