Google AMP instrumentation

Compass tracks AMP page views with the native amp-analytics element.

Add AMP Analytics

If you don’t already use amp-analytics in your pages, add the following script tag in the head of all your pages that Compass should track.

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

This script must be present only once in your AMP pages. If you already have it, don’t add it again and simply jump to the following section.

Enable Compass in AMP pages

Once you import the amp-analytics script in the body of your AMP pages, the only thing you need is your client ID.
Replace the 000 in this snippet by your personal account ID:

<amp-analytics config="https://events.newsroom.bi/amp.v1.json" data-credentials="include">
  <script type="application/json" >
    {
      "vars" : {
        "accountId": "000" //USE YOUR PERSONAL ACCOUNT ID
      }
    }
  </script>
</amp-analytics>
Important: This code should be placed in the body of your AMP pages.
The `accountId` is the same value as the account ID you use to track users with Compass Web integration.


Remember to replace the 000 value with your own!

Ads in Amp

In order to track properly the ads is recomended to add the parameter data-vars-ad-slot to the amp-ad with the slotname information.

<amp-ad width="300" height="250" type="foo" data-vars-ad-slot="SLOTNAME">
  <div placeholder>Loading ...</div>
</amp-ad>