Repository navigation
UNI-1091: Premium Analytics: Add Bot activity to the post page - #55540
Nikschavan wants to merge 3 commits into
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Premium Analytics plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Stats Data plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
dff1216 to
ee3fede
Compare
cfbe969 to
916fcde
Compare
ee3fede to
f0ee062
Compare
916fcde to
b6ba11d
Compare
The Stats post row carries the post's public URL for every post type. Type it, and fall back to it in the post page header when core data has no entity and no list page carried a URL.
…e post's path The edge logs have no post ID, so a post-scoped edge report reads the post's path from its Stats permalink and sends it as url. The report waits for the path, so it never counts the whole site under a post's heading. The ai-traffic widgets join the widget support check, as File downloads and the VideoPress widgets do, so they register and appear in default layouts only where the AI traffic surfaces are available.
…ports Bot activity moves above it, so the reports still end on the post's whole history.
b6ba11d to
8580273
Compare
Fixes UNI-1110
Related to UNI-1091
Proposed changes
Builds on #55485 (Bot activity), which builds on #55334. This PR's own changes are the last two commits. It is the first part of UNI-1091: the other post page widgets come in later PRs.
url=/2026/11/21/hello-world/), not bypost_id. The widget still passesreportParamsas it does on the AI tab. When they carry apost_id, the data hook reads the post's permalink fromstats/post/<id>?fields=post, the query the post page header already runs, so no extra request goes out, and sends the permalink's path and query string asurl. This works like the UTM widget, which also readspost_idfromreportParams, butstats/utmtakes the ID directly.ai-traffic/*widgets join the widget support check inwidget-type-support.php, as File downloads does for WPCOM Simple and the video widgets do for VideoPress: off the AI traffic surfaces they do not register, and default layouts drop them. Requests by source and Top AI companies get the same gate, so the layout lists Bot activity with no condition of its own.show_in_rest: falseopened from a bookmark or a notification had no link before.Edge cases this does not handle yet:
%e3%81%82and%E3%81%82, and the permalink matches only the lower-case form, which is the one WordPress writes. On sites with Japanese and Chinese slugs, that misses about half of those requests. The fix belongs in the templates (compare the path without regard to case), so I will raise it on DLINK-570.On a local site with made-up edge data:
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Edge data exists only for VIP sites, so a site you can test on gets an empty widget. You can still check that the request is scoped to the post. Check out this branch on a Jetpack Docker site, or sync it to a Jurassic Ninja site, and build
plugins/premium-analytics.add_filter( 'jetpack_feature_flag_enabled_jetpack-stats-ai-tab', '__return_true' ); add_filter( 'jetpack_premium_analytics_ai_traffic_available', '__return_true' );stats/ua-queries?template=bot-activityrequest. It hasurl=set to the post's path, such as%2F2026%2F11%2F21%2Fhello-world%2F. Nostats/ua-queriesrequest goes out withouturl.url.I checked the steps above on a local site, with a local mu-plugin that answers
stats/ua-querieswith made-up rows. I did not check against the real endpoint on a VIP site.