How to add piwik to amp pages?

You can easily track your pages with Piwik using <amp-pixel> tag in this way:

// change your piwik server host
// change YOUR_SITE_ID with your site id
// All other variables will be replaced by AMP, see https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md
<amp-pixel src="https://piwik.example.org/piwik.php?idsite=YOUR_SITE_ID&amp;rec=1&amp;action_name=TITLE&amp;urlref=DOCUMENT_REFERRER&amp;url=CANONICAL_URL&amp;rand=RANDOM"></amp-pixel>