LogoLogo
Help CenterStatusContact
  • Chartbeat Documentation
  • Implement Tracking
    • Standard Websites
      • Adding chartbeat.js to Your Site
      • Customize Tracking Settings
      • Tracking Virtual Page Change
      • User Subscriber Status
      • Alternative Site Integrations
      • Integration QA Steps: Website
      • Additional Page Metadata
    • Google AMP
      • Chartbeat Code for AMP
      • AMP Configuration Variables
      • Alternative AMP Integration
      • Integration QA Steps: AMP
    • Mobile App SDKs
      • Intro to Mobile App Tracking
      • Android SDK
      • iOS SDK
      • Integration QA Steps: Mobile Apps
  • Feature Integrations
    • Headline and Image Testing
      • Adding chartbeat_mab.js to Your Site
      • Image Compatibility
      • Flicker & Flicker Control
      • mab.js Specifications
      • Integration QA Steps: Headline and Image Testing
    • Video Engagement
      • Adding chartbeat_video.js to Your Site
      • Supported OVP Integrations
      • Custom Player Integration SDK
      • Configure Video Tracking Settings
      • Integration QA: Video Tracking
    • Conversion
      • Adding subscriptions.js to Your Site
      • Conversion Events
      • Integration QA Steps: Conversion
      • Supported Conversion Flows
  • API Docs
    • Real-Time API
      • Getting Started with our Real-Time API
      • Traffic Data
      • Video Engagement Data
    • Historical API
      • Getting Started with our Historical API
      • One-time Queries
      • Recurring Queries
      • Metrics, Dimensions, and Filters
    • Headline Testing API
      • Getting Started with our Headline Testing API
      • Raw Data
      • Summary Report
      • Variant Report
    • Conversion API
      • Getting Started with our Conversion API
      • Top Articles
    • Data Lab API
      • Getting Started with Data Lab API
  • Help Center
  • Contact Support
  • Datastream Docs
  • Back to Chartbeat.com
Powered by GitBook
On this page
  • Introduction
  • Required AMP variables
  • Recommended AMP variables
  • Additional AMP variables
  • IP Truncation
  • Next steps

Was this helpful?

  1. Implement Tracking
  2. Google AMP

AMP Configuration Variables

Available Chartbeat configurations to be passed into your AMP implementation code.

PreviousChartbeat Code for AMPNextAlternative AMP Integration

Last updated 10 months ago

Was this helpful?

Introduction

The page property metadata (sections, authors, path, title, and content type) configured to send from your AMP pages should match exactly the data we receive from those same pages on your non-AMP website via our , and stay consistent across all of your other Chartbeat tracked platforms. This is important to ensure accurate page-level engagement tracking in your team's Chartbeat dashboards and audience reports.

Required AMP variables

These variables must be set in your snippet for data to appear in your dashboards.

Field Name

Description

Example Input

uid

A five-digit numerical value associated with your Chartbeat account.

12345

domain

This value should be set to the site id of your website as it appears in your Chartbeat account homepage. This is usually the root domain without http or 'www.' prepended.

site.com

For more information on setting the UID and domain variables, see our article within our integration guide for non-AMP sites.

Recommended AMP variables

Field Name

Description

Example Input

sections

Accepts a comma separated list of values for the page's section(s).

sports,news

authors

Accepts a comma separated list of values for the page's author(s).

John Doe

Tip: Chartbeat uses the "|" character for a splitting process when organizing section and author values, so it is recommend to avoid this character when defining these variables.

Example usage:

<amp-analytics type="chartbeat">
    <script type="application/json">
        {
            "vars": {
                "uid": "12345",
                "domain": "yoursite.com",
                "sections": "News",
                "authors": "John Doe"
            }
        }
    </script>
</amp-analytics>

These variables accept one or multiple string values parsed by comma, so the examples directly above and below would both be acceptable formats.

<amp-analytics type="chartbeat">
    <script type="application/json">
        {
            "vars": {
                "uid": "12345",
                "domain": "yoursite.com",
                "sections": "News,Sports",
                "authors": "John Doe,Jane Doe"
            }
        }
    </script>
</amp-analytics>

Additional AMP variables

Field Name

Description

Example Input

canonicalPath

By default, our tracker collects the page path from the rel="canonical" <link> element in your AMP HTML. If you are unable or prefer to not use the canonical link set in your site's AMP HTML, you may override this default setting. We highly recommend that you use a real path used to navigate to this page.

site.com/path

title

By default, our tracker collects page titles from the <title> tag in your AMP HTML. You can use this variable to override this setting by assigning custom page titles in your Chartbeat for AMP code.

Article Title

contentType

For customers making use of our Advanced Queries tool, this variable accepts a single string value to supplement your Chartbeat historical data with additional information about the type of content a given page falls under, like 'gallery page', 'standalone video page', etc.

gallery page

sponsorName

For customers making use of our Advanced Queries tool, this variable accepts a single string value to supplement your Chartbeat historical data with additional information about your sponsored content (advertorial) campaign name IDs, such as 'Mercedes', 'Mastercard-Jun2020', 'Netflix-Q1-2021-CID123', etc.

Mercedes

Example usage:

<amp-analytics type="chartbeat">
    <script type="application/json">
        {
            "vars": {
                "uid": "12345",
                "domain": "yoursite.com",
                "sections": "News",
                "authors": "John Doe",
                "canonicalPath": "yoursite.com/article-xyz.html",
                "title": "My Article Title",
                "contentType": "article page"
            }
        }
    </script>
</amp-analytics>

IP Truncation

For clients in the EU, use the following <amp-analytics> configuration for Chartbeat to override the host parameter and point traffic to our proxy layer that de-identifies IP addresses within the EU:

<amp-analytics type="chartbeat">
    <script type="application/json">
        {
            “requests”: {“host”: “https://pong.chartbeat.net”},
                "vars": {
                "uid": "12345",
                "domain": "yoursite.com",
                "sections": "section 1,section 2", 
                "authors": "John Doe"
            }
        }
    </script>
</amp-analytics>

Next steps

If your team uses Google Tag Manager for your AMP pages, you have the option to use our pre-built Chartbeat for AMP GTM tag template instead of adding our code directly to your AMP HTML. If you do not use Google Tag Manager, you can skip ahead to our .

integration QA steps article
standard JavaScript tag
customize tracking settings