# Analytics in AMP pages?

**URL:** <https://forum.ghost.org/t/analytics-in-amp-pages/1030>\
**Category:** Ideas\
**Created:** [April 21, 2018, 7:02pm UTC](https://forum.ghost.org/t/analytics-in-amp-pages/1030 "2018-04-21T19:02:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![em\_div](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/em_div/32/383_2.png) [@em\_div](https://forum.ghost.org/u/em_div)\
**Post date:** [April 21, 2018, 7:02pm UTC](https://forum.ghost.org/t/analytics-in-amp-pages/1030/1 "2018-04-21T19:02:12Z")

</div>

Does the Casper theme and default way AMP pages are created include support for Analytics?

Specifically, if I use the code injection at the site level in Ghost Admin, will that tracking carry over into the AMP pages or do I have to create a custom hbs file in order to track AMP data?

---

<div class="post-metadata">

**Author:** ![HauntedThemes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hauntedthemes/32/15301_2.png) [@HauntedThemes](https://forum.ghost.org/u/HauntedThemes)\
**Post date:** [April 22, 2018, 8:04am UTC](https://forum.ghost.org/t/analytics-in-amp-pages/1030/2 "2018-04-22T08:04:29Z")

</div>

Analytics in AMP pages do not work with the same script that you usually use for Analytics. Accelerated Mobile Pages require a different Analytics tag.

Here are a few links that might help you understand how to set Analytics for AMP pages:

[Tracking Accelerated Mobile Pages (AMP)](https://support.google.com/analytics/answer/6343176?hl=en)  
[Adding Analytics to your AMP pages](https://developers.google.com/analytics/devguides/collection/amp-analytics/)  
[AMP Analytics by example](https://ampbyexample.com/components/amp-analytics/)  
[Analytics and AMP - How to Track ALL THE THINGS (AMP Conf 2018)](https://www.youtube.com/watch?v=96FNOI8hb2s)

The best way to do this is to save the `amp.hbs` file:

[AMP default template](https://github.com/TryGhost/Ghost/blob/master/core/server/apps/amp/lib/views/amp.hbs)

Put it into your theme folder. Do the required changes and it should work.

After you do your changes be sure that everything is validated. To do this add `#development=1` to the URL of the page. You will see your errors, if you have, in Console tab. [Debugging](https://developers.google.com/analytics/devguides/collection/amp-analytics/#debugging).
