jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Stats tracking code missing from AMP pages since 6.2

Open danjjohnson opened this issue 8 years ago • 2 comments

Steps to reproduce the issue

  1. Create a test site with Jetpack 6.1.1
  2. Connect Jetpack and enable stats.
  3. Install the AMP plugin: https://wordpress.org/plugins/amp/
  4. Publish a post.
  5. View the source code of the /amp/ version of a post. See the tracking code starting with <amp-pixel
  6. Upgrade to Jetpack 6.2
  7. View the source code again.

What I expected

The stats tracking code should still be there.

What happened instead

It's not there.

Reported in 1210111-zen

danjjohnson avatar Jun 08 '18 14:06 danjjohnson

This is because the AMP plugin was updated to back off of adding JP support in 6.2: https://github.com/Automattic/amp-wp/commit/c280a5177aec0f9707e042326b399ef6e56b5905

Jetpack is checking for amp_is_canonical : https://github.com/Automattic/jetpack/commit/1bd4eaa3c6dee1e8fd10c10d5c8598c7fd27d41d#diff-f26e9ed01c2ca4e906e59c7c15b45ab1R69

That function, though, is to check if themes are declaring their own AMP support, thus short-circuiting the default templates: https://github.com/Automattic/amp-wp/blob/6e6275b84bba131010a90dbea4d325986728057b/amp.php#L274

EDIT: https://github.com/Automattic/jetpack/pull/9625 looks like it should have addressed this, so might be something else. No joy nevertheless for a pixel in amp.

kraftbj avatar Jun 08 '18 14:06 kraftbj

I think I may have come across a site experiencing behaviour related to this in #1208872-zen.

Tracking code is present on non-AMP pages, but missing on AMP pages, which is causing stats from Twitter to not report correctly in Calypso.

interlineae avatar Jun 08 '18 16:06 interlineae