Marfeel tracks AMP page views with the native amp-analytics
element.
Add AMP Analytics
If are not already using 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.
Enable Compass in AMP pages
Initialize the amp-analytics in the <body>
of your AMP pages ensuring your unique account ID is correctly added before /* AccountId */
:
<amp-analytics config="https://events.newsroom.bi/amp.v1.json" data-credentials="include">
<script type="application/json" >
{
"vars" : {
"accountId": "/* AccountId */"
}
}
</script>
</amp-analytics>
Ads in Amp
In order to properly track the ads is recommended to add the parameter data-vars-ad-slot
to the amp-ad with its slotname
information.
<amp-ad width="300" height="250" type="foo" data-vars-ad-slot="SLOTNAME">
<div placeholder>Loading ...</div>
</amp-ad>
Custom Page Technology
On AMP you can override the default pageType
adding a var directly on the Marfeel snippet:
<amp-analytics config="https://events.newsroom.bi/amp.v1.json" data-credentials="include">
<script type="application/json" >
{
"vars" : {
"accountId": "/* AccountId */"
},
"extraUrlParams": {
"pageType": 3
}
}
</script>
</amp-analytics>