amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Add built-in vendor configuration for Chartbeat analytics

Open breauxc opened this issue 10 years ago • 6 comments

Objective

Add the built-in configuration tag for Chartbeat analytics. Offshoot from #871 .

Overview

Chartbeat will follow shortly with a PR with our vendor implementation. Engaged time metrics are yet available: See #1296 .

Sample Implementation (vendors.js)

{
  'requests': {
    'host': 'https://ping.chartbeat.net',
    'requestPath': '/ping',
    'basePrefix': 'h=${dashboardDomain}&' +
      'p=${canonicalPath}&' +
      'u=${clientId}&' +
      'd=${canonicalHost}&' +
      'g=${accountId}&' +
      'g0=${sections}&' +
      'x=${scrollTop}&' +
      'w=${screenHeight}&' +
      't=${pageViewId}',
    'baseSuffix': '_',
    'pageview': '${host}${requestPath}?${basePrefix}&' +
      'i=${title}&' +
      '${baseSuffix}',
    // Possible engagement request. Engaged time metrics are not currently
    // available.
    'engagementInterval': '${host}${requestPath}?${basePrefix}&'
      'E=${totalEngagedTime}&' +
      '${baseSuffix}'
  },
...
}

Sample Client Implementation

<amp-analytics type="chartbeat">
  <script type="application/json">
    {
      // These variables override the defaults provided by chartbeat and amp.
      'vars': {
        'accountId': '12345',
        'title': 'Override Default Page Title', // Optional
        'authors': 'Jane Doe, John Smith',      // Optional
        'sections': 'news,europe',              // Optional
        'canonicalPath': '/news/story.html'     // Optional, overriding default is not recommended
        'dashboardDomain': 'client.com'         // Optional
      }
    }
  </script>
</amp-analytics>

breauxc avatar Jan 14 '16 22:01 breauxc

Assuming this is your intent to implement, so adding the label.

rudygalfi avatar Jan 14 '16 22:01 rudygalfi

LGTM got for the ITI.

Great to have you on board!

cramforce avatar Jan 14 '16 23:01 cramforce

cc @avimehta @btownsend to review config syntax when the PR is ready or for any discussion here.

dashboardDomain is unfamiliar. Is this a variable clients are expected to fill in?

rudygalfi avatar Jan 14 '16 23:01 rudygalfi

dashboardDomain is unfamiliar. Is this a variable clients are expected to fill in?

Yes. It's a client configuration value.

britice avatar Jan 19 '16 22:01 britice

cc @jmadler

rudygalfi avatar Jan 30 '16 01:01 rudygalfi

Closed by #1712

rudygalfi avatar Feb 05 '16 22:02 rudygalfi