Read on after the fold for:
The Accelerated Mobile Pages (AMP) Project is an open source initiative to help publishers create mobile-optimized content that loads near-instantly. AMP HTML is AMP’s code framework for building mobile-optimized web pages. AMP HTML has an analytics component which integrates various analytics vendors, including now Snowplow.
To learn more about analytics for AMP pages see the amp-analytics reference. For general information about AMP see What Is AMP? on the Accelerated Mobile Pages (AMP) Project site.
AMP is necessarily a simplified, largely static environment for content, so our Snowplow support consists of just two possible “trigger requests” so far:
pageViewfor page view tracking
unstructEventfor structured event tracking
Let’s look at each of these in turn.
You can track a Snowplow page view in AMP like so:
Google Analytics-style structured events can be sent by setting the AMP trigger request value to event and setting the required event category and action fields.
The following example uses the selector attribute of the trigger to send an event when a particular element is clicked:
vars for structured events are:
Further information on using Snowplow with AMP can be found on the Snowplow wiki.
If you create any issues or PRs into the AMP HTML GitHub repository regarding Snowplow support, please be aware that we will not be aware of these unless you mention Snowplow team members on the issue.
If you have any questions or run into any problems, please get in touch with us through the usual channels.