Ghost: AMP Analytics

Created on 19 Apr 2017  Â·  4Comments  Â·  Source: TryGhost/Ghost

The idea site doesn't appear to be working. Not sure if this is better suited for there.

I think since AMP is added by default & there is also a Google Analytics option in the admin section, AMP should also have Google's Analytics baked into it. Google explains how to do this here - https://developers.google.com/analytics/devguides/collection/amp-analytics/

This is an easy fix for my own version of Ghost by copying the AMP default theme into my theme & then adding it. I just think this would be a nice included by default kind of thing.

Most helpful comment

Whoops... Forgot that's where I added it. :flushed:

I understand why code injection wouldn't be allowed for AMP since it's very particular about what code is injected.

Simple fix is just to do it in the AMP theme then. Thanks!

All 4 comments

Hey @mattferderer 👋

Google Analytics is not an option in the admin section. Users can add Google Analytics via a Code Injection e.g. ghost_head.

Code Injection is not allowed for AMP.
@AileenCGN Why is that again?

Whoops... Forgot that's where I added it. :flushed:

I understand why code injection wouldn't be allowed for AMP since it's very particular about what code is injected.

Simple fix is just to do it in the AMP theme then. Thanks!

@mattferderer got the points right, @kirrg001 !

Solution would be to have a custom AMP template with the analytics code.

For those who have the same needs, here's how — https://blog.ghost.org/custom-amp-themes/

Was this page helpful?
0 / 5 - 0 ratings