Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 800 forks source link

Jetpack Stats does not track outbound link clicks on AMP pages #17172

Open westonruter opened 3 years ago

westonruter commented 3 years ago

As reported in an AMP plugin support forum topic:

Jetpack stopped counting Users’ clicks on outbound links when I set up AMP. […] when I click on “Site Stats” for a single day, the right column is “Top Posts & Pages”, and under that report of pages is another report called “Clicks”. It says: “your visitors clicked these links on your site”. It should then list all the links clicked, which on my site are links to individual books and magazines that users opened.

Since I installed AMP, it has said “No clicks recorded. (Clicks are viewers clicking outbound links on your site.)” I have no idea how Jetpack actually records the clicks.

The user is in the AMP plugin's Standard mode, so no non-AMP pages are being served. If not in Standard mode, there would be outbound clicks registered for non-AMP pages.

It appears that AMP-compat for the Stats module is currently limited to pixel tracking:

https://github.com/Automattic/jetpack/blob/ec48e84b8d68162e0bb7d70cc4cf28c2a63c94ab/modules/stats.php#L269-L279

So the AMP version only implements view but not clickTrackerInit as in the non-AMP version:

https://github.com/Automattic/jetpack/blob/ec48e84b8d68162e0bb7d70cc4cf28c2a63c94ab/modules/stats.php#L258-L263

It appears that using amp-pixel is too rudimentary for the needs of the Stats module, and that amp-analytics with an in-house configuration should be used instead.

See AMP documentation on tracking page clicks.

Steps to reproduce the issue

  1. Enable Standard mode or Transitional mode
  2. Go to an AMP page
  3. Click an outbound link
  4. No HTTP c.gif request is spawned upon clicking the link, e.g. https://pixel.wp.com/c.gif?s=2&u={urlL}&r=&b=123456789&p=1235&rand=0.6138363861055471

What I expected

Outbound link clicks should be tracked.

What happened instead

Only page views are tracked.

gaurav1984 commented 3 years ago

Reported in 3321850-zen

opeedo commented 3 years ago

Please when is this issue going to be resolved? It doesn't make sense to have an AMP site without the Jetpack stats functioning well. How do we monitor performance then?

jeherve commented 3 years ago

@opeedo We have not made progress on this yet, but we'll update this issue when we do.

TLienhart commented 3 years ago

Any progress on this issue? There are still no clicks being recorded on my site.

Darkkandadr commented 2 years ago

Any progress?

tfk2 commented 9 months ago

any update, it's been a few years now.

github-actions[bot] commented 9 months ago

Support References

This comment is automatically generated. Please do not edit it.

TLienhart commented 9 months ago

I gave up trying to use AMP two years ago. I no longer care if this is fixed.