AMP offers two main components for analytics tracking: amp-pixel, and amp-analytics. With amp-pixel, we can do simple pixel-tracking pageview analytics. If we want to do anything more advanced, such as click- or scroll-tracking, then we need to look at amp-analytics.
Analytics support in AMP
Pixel tracking with <amp-pixel>
The amp-pixel component offers simple pixel-tracking analytics. It's a core component, so there's no need to include any script. With amp-pixel you simply provide a URL that will register a pageview, for example:
<amp-pixel src="https://a.theampbook.com/?idsite=1&rec=1&action_name=TITLE&url=CANONICAL_URL&rand=RANDOM">
Note the following:
- The src attribute...