- 2 Minutes to read
- Print
- DarkLight
Implementation with amp analytics
- 2 Minutes to read
- Print
- DarkLight
The "amp-analytics" element can be used to measure activities in an AMP-document. For example, the following event types are supported:
Page call
clicks
timer
scrolling
In this chapter, you will learn how to implement the "amp-analytics" tag for Mapp Intelligence tracking in your AMP pages.
Activate AMP-Analytics
Please include the amp-analytics script in the head-tag to enable tracking for your AMP pages:
Example
<head>
<!-- ... -->
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
Mandatory Configuration
Please note that the tracking information will only be sent after an AMP page has been fully loaded. If the user leaves the page before the pixel has been sent, Mapp Intelligence will not receive any information about the user action. To prevent data loss, please include the Mapp Intelligence analytics tag just before closing the <body> tag.
Account Configuration
After you have made the necessary addition to activate tracking for AMP pages, add the "amp-analytics" tag to your HTML code and make the following settings here:
Example
<body>
<!-- ... -->
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111"
},
...
}
</script>
</amp-analytics>
</body>
Parameter | Description |
---|---|
trackDomain | Specify your track domain. |
trackId | Enter your track ID.
|
Page Configuration
As a rule, websites consist of individual pages. Visitors navigate between the pages and perform various actions on them.
The unique identification of the individual pages is of central importance in web analytics. Therefore, meaningful naming is the foundation for using Mapp Intelligence effectively. The page names should be unique and provide useful information about the respective page. For example, a comprehensible name for the homepage of a website would be "index" or "home". In addition to such manual naming through the pixel, Mapp can perform automatic naming.
Multiple pages can be combined in content groups to support aggregated analyses. Different page calls for a page can be described in greater detail by transmitting a page parameter.
Page tracking has to be started by calling the corresponding "trigger":
<body>
<!-- ... -->
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111",
"contentId": "de.startpage"
},
"triggers": {
...
"trackPageview": {
"on": "visible",
"request": "pageview"
},
...
}
}
</script>
</amp-analytics>
</body>
Parameter | Description |
---|---|
trackPageview | This parameter is used to configure page tracking. |
contentId | Optional. You can use this parameter to provide a meaningful, manually created name for the page as analyzed in Intelligence. If you do not set this parameter, an automatic name is used based on the title of the HTML page (<title> tag) |