Repository navigation
UNI-1088: Premium Analytics: Add the Bot activity widget to the AI tab - #55485
Draft
Nikschavan wants to merge 4 commits into
Draft
Nikschavan wants to merge 4 commits into
Nikschavan wants to merge 4 commits into
Conversation
Contributor
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Contributor
|
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! |
Nikschavan
changed the base branch from
trunk
to
add/uni-1086-top-ai-companies
November 26, 2026 08:32
Nikschavan
force-pushed
the
add/uni-1088-bot-activity
branch
from
November 27, 2026 09:37
dff1216 to
ee3fede
Compare
Ranks the bots that requested the site in six groups, from AI training to unidentified bots, from the two halves of the bot-class-and-name template. The groups are mapped in the client until the template returns them (DLINK-570).
The template returns the six groups in one request, in display order, with served requests only, so the widget no longer maps edge classes or merges two halves. Ranges ending in the last two UTC days read the raw table, since the rollup has no rows for them yet.
… grows past a year Stats queries keep the previous range's data as a placeholder, so a range too long to request showed the old groups instead of the message. Also test the rollup cutoff for a short past window and the single request when the host passes comparison dates.
Nikschavan
force-pushed
the
add/uni-1088-bot-activity
branch
from
November 27, 2026 09:48
ee3fede to
f0ee062
Compare
Groups pair by key and bots by name within their group. A bot outside the comparison period's top bots has no previous value, since the template returns only the top bots of each group.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes UNI-1088
Proposed changes
Builds on #55334 (Top AI companies), which builds on #55331. This PR's own change is the last commit; the earlier commits belong to #55334.
stats/ua-querieswith thebot-class-and-nametemplate. The template requiresbot_category(aiornon-ai) and has no value for both, so the widget sends one request for each and ranks the groups of both together. The template'sclass_pctandbot_pctare computed within one half, so they cannot be compared across the two and the widget does not use them.build-bot-groups.ts, with the mapping from UNI-1088. This is a bridge until the template returns the groups itself (DLINK-570); the mapping and the second request go away then. A bot the edge files under two classes of one group, such as Perplexity-User under both AI Assistant and AI Agent, shows as one row.describeError(), so an access error does not offer a Retry that cannot help.edge-window.tsasEDGE_ROLLUP_MAX_DAYS, and Requests by source reads the same constant.jetpack-stats-ai-tabflag, so nothing changes for any site.Open questions this PR does not settle, all on UNI-1088:
WordPressat the top.The template takes whole days, so for Last 24 hours the widget counts the whole UTC days the window touches. The post page is a separate PR (UNI-1091).
On a local site with made-up data:
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
The data only exists for VIP sites and the tab is behind the flag, so use Storybook.
cd projects/js-packages/storybook && pnpm run storybook:devWhat I ran:
apiFetch, so the hook, the query and the sanitizer run too. Each guard the widget adds (the error on one failed first load, the rows kept after a failed refresh, the error copy and the long-range check) makes its test fail when it is removed.jp test php packages/premium-analytics,tsgo --noEmit, ESLint and PHPCS are clean.Not checked: