Same here. Google Analytics is working fine. Jetpack stats are not working since AMP upgrade. In source code this is missing on the AMP-pages:
<script type='text/javascript' src='https://stats.wp.com/e-201850.js' async='async' defer='defer'></script>
Already had contact with Jetpack about this issue. They’re also looking into it.
-
This reply was modified 4 years, 5 months ago by
YuriV.
@dartiss Are you in classic mode or paired/native?
@yuriv This script would be invalid AMP so it would get stripped out by the AMP plugin.
Jetpack should be using the amp-pixel
component instead of using a custom script. More info here: https://www.ampproject.org/docs/reference/components/amp-pixel
Let’s continue the discussion on GitHub here: https://github.com/ampproject/amp-wp/issues/1722
Hi Weston 👋🏼Congratulations on the new job!
Are you in classic mode or paired/native?
Classic. Literally changed nothing in the settings since installing the new version.
I have multiple sites that I admin showing the same issue – no amp URLs being tracked by Jetpack since the update (and confirmed by drilling down into the states).
Will move over to the Github issue and continue discussion there.
Thanks! As continued in the GitHub comments, here is a quick fix for the problem: https://github.com/ampproject/amp-wp/issues/1722#issuecomment-445885819
Could anyone please post here, when the fix is integrated in a Jetpack- / AMP-Plugin-Update?
The issue is with Jetpack, so you will need to follow this fix which Weston has kindly provided to that team…
https://github.com/Automattic/jetpack/pull/10918
Phew! This explains a lot. I thought I had been hit with another google penalty. lol
Are you sure it is jetpack issue? When I use AMP Plugin ver. 0.7.2 stats are working propertly, in AMP ver. 1.0.0 and 1.0.1 stats are missing in Jetpack Stats.
@lumay Yes, it’s a Jetpack issue because Jetpack was looking specifically for v1.0 of the AMP plugin. This is part of what the Jetpack PR fixes. See https://github.com/Automattic/jetpack/pull/10945/files#diff-f26e9ed01c2ca4e906e59c7c15b45ab1L82
Oh, Thx @westonruter, so we’re waiting for Jetpack Fix 🙂
Alternatively, you can add this code to a custom plugin or your theme’s functions.php
as a temporary workaround: https://github.com/ampproject/amp-wp/issues/1722#issuecomment-445885819
Thank you I’ve added this code to my theme’s function.php
but I think it doesn’t work. Where I could try to add this code? For example to AMP plugin function.php
file?
-
This reply was modified 4 years, 5 months ago by
Łukasz.
No, it should not go in the AMP plugin, as it will get overridden. It should go in your theme’s functions.php
file or in a custom plugin. You could create a file at wp-content/mu-plugins/jetpack-amp-workaround.php
that just contains the above code.
That being said, I haven’t tested this code myself. It should work in theory.
hmm, I think it doesn’t work. But nvmd – I’ll wait for Jetpack Fix.
Thank you Weston!