You are here

amp-analytics.html.twig in Accelerated Mobile Pages (AMP) 8

Template for amp-analytics.

Available variables:

  • account: The analytics account ID.
  • attributes: The HTML attributes for amp-analytics, primarily:
    • type: The type of analytics account.

See also

template_preprocess_amp_iframe()

File

templates/amp-analytics.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template for amp-analytics.
  5. *
  6. * Available variables:
  7. * - account: The analytics account ID.
  8. * - attributes: The HTML attributes for amp-analytics, primarily:
  9. * - type: The type of analytics account.
  10. *
  11. * @see template_preprocess_amp_iframe()
  12. */
  13. #}
  14. <amp-analytics{{ attributes }}>
  15. <script type="application/json">
  16. {
  17. "vars": {
  18. "account": "{{ account }}"
  19. },
  20. "triggers": {
  21. "trackAmpview": {
  22. "on": "visible",
  23. "request": "pageview"
  24. }
  25. }
  26. }
  27. </script>
  28. </amp-analytics>