Repository navigation
Conversation
- Shared Stats_Provider abstraction, Jetpack Stats adapter, and Anonymizer - Content Gap Suggestions experiment, ability, and dashboard widget - PHPUnit + e2e coverage; phpstan/phpcs clean
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #929 +/- ##
=============================================
+ Coverage 81.67% 82.00% +0.33%
- Complexity 3103 3186 +83
=============================================
Files 129 136 +7
Lines 12334 12627 +293
=============================================
+ Hits 10074 10355 +281
- Misses 2260 2272 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…8-content-gap-suggestions # Conflicts: # tests/e2e-testing/e2e-testing.php
…ty registration test
|
@jeffpaul CI is passing. It's ready for review whenever you have the chance. |
…8-content-gap-suggestions
…ions - Drop removed enableExperiments helper from the e2e spec - Dismiss the welcome guide reliably in the create-draft test - Add Jetpack provider and ability tests with a Jetpack Stats stub - Make ability registration test independent of test order
…ase labels - Require manage_options in the ability and script enqueue to match the dashboard widget gate - Rename 'Create Draft' to 'Create draft'
|
@dkotter CI is green and this is ready for review whenever you have the chance. |
jeffpaul
left a comment
There was a problem hiding this comment.
Not able to test this quickly (@zeus2611 if you can share the snippet in the PR description for others to try and load in test info), so this comment focuses more on the null/empty state...
After clicking the Generate suggestions button the preceding copy and button are updated to just a Try again button with no other info.
If there's an error or warning that we can throw in this case to give a site owner a little more context on what's not working, that would be ideal.
What?
See #338 (1 of 2 PRs — Traffic Surge Amplification follows separately)
Adds the Content Gap Suggestions experiment: a dashboard widget that surfaces new post topic ideas based on anonymized search patterns from a connected analytics plugin (Jetpack Stats for v1). Also adds the shared
Stats_Providerabstraction and anonymization layer that PR 2 (Traffic Surge Amplification) will build on.Why?
Issue #338 asks for two AI-assisted editorial signals sourced from site analytics: content gaps (this PR) and traffic-spike amplification (follow-up PR). The issue explicitly scoped v1 to Jetpack Stats only, a dashboard widget over an admin page, and no on-site search-log fallback — all reflected here. Any resulting draft must require human review before publishing, so suggestions only ever create a WordPress draft; nothing is published or posted automatically.
How?
includes/Stats/Stats_Provider.php— interface for analytics adapters (is_available(),get_search_queries(),get_post_traffic())includes/Stats/Stats_Provider_Registry.php— resolves the first available provider; extensible viawpai_stats_providersfilterincludes/Stats/Providers/Jetpack_Stats_Provider.php— wrapsstats_get_from_restapi(). Note: Jetpack'ssearch-termsdata is external search-engine referrer terms, not on-site search queries — used here as a proxy signal for content gaps, not a literal zero-result-search report (Jetpack has no on-site search tracking)includes/Stats/Anonymizer.php— the AI-safety boundary: drops low-count/single-occurrence terms, strips anything that looks like an email or long digit run (phone/order IDs), normalizes and merges the rest into aggregate patterns. Only these patterns are sent to the AI provider — raw query strings never leave this layerincludes/Experiments/Content_Gap_Suggestions/+includes/Abilities/Content_Gap_Suggestions/— the experiment and its ability, following the existingAbstract_Feature/Abstract_Abilitypattern used elsewhere in the plugin. Structured JSON output viaas_json_response()includes/Admin/Dashboard/Content_Opportunities_Widget.php— dashboard widget, gated on the experiment being enabled. Renders only a mount point + "Generate" button; loading the dashboard never triggers an AI call, only clicking doessrc/experiments/content-gap-suggestions/): generate → list suggestions → "Create Draft" (creates a realpost_status: draftpost via REST and opens it in the editor) or "Dismiss"Use of AI Tools
AI assistance: Implementation was planned with assistance from Claude Code (Anthropic). All code was reviewed, tested, and validated.
Testing Instructions
npm install && composer installnpm run buildStats_Providervia thewpai_stats_providersfilter to get deterministic search-pattern data (see PR description or ask — happy to share the snippet)Screenshots or screencast
Changelog Entry