Repository navigation
Premium Analytics: Add post detail Post highlights widget - #50457
Merged
Merged
Conversation
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.
Part of WOOA7S-1622 / WOOA7S-1526 (supersedes the parked #50351). The fixed page composition that places this card lives in #50488, stacked on this PR (split back out per review).
Why
The post/page detail page has no card showing how the post performed. This adds the Traffic view's highlights card per the current design: views, comments, and likes at a glance. (#50488, stacked on this PR, makes the page a fixed composition that renders it out of the box.)
Proposed changes
jpa/post-detail-highlightswidget: the scoped post's Views / Comments / Likes as metric tiles through the sharedMetricTileGrid, scoped to the post viareportParams.post_id.stats/postresponse — comparison costs no second request.previousValue: nullkeeps the comparison layout aligned without a fabricated delta.stats/post/{id}endpoint'sdatafield — the post's full daily view history as[date, views]tuples — throughStatsPostField, the response types, and the sanitizer (normalized oldest-first, with a normalizer test).reportsicon as a 48px two-tone illustration matching the rest of the icon set (it was the one remaining 24px solid glyph, rendering dark and heavy in 48px empty-state slots; orders-fulfillment's empty state picks up the fix too).stats-postfixture (deterministic daily series ending today) routed inrouteStatsReport(), withDefault/WithComparison/NoPostScope/WidgetDashboardWithWidgetstories and ahasPostScopecontrol.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. The widget reads the existing
stats/postendpoint through the established proxy;datais an already-served response field.Verification
pnpm run typecheck, eslint, the data-layer normalizer test, and the post-detail route tests pass; the widget-audit checklist (shape/contract/chrome/tokens/i18n/JSDoc) holds. Exercised against a live post-detail page on a local docker env.Testing instructions
projects/packages/premium-analytics:pnpm run typecheck,pnpm run test packages/data/src/processing/stats/__tests__/post.test.ts routes/post-detail.pnpm run storybook:devfromprojects/js-packages/storybook): openPackages/Premium Analytics/Widgets/PostDetailHighlights—Defaultshows the three tiles;WithComparisonadds a delta to Views only;NoPostScopeshows the scopeless empty state.admin.php?page=jetpack-premium-analytics-wp-admin&p=%2Fpost%2F<post-id>), enter edit mode, add the "Post highlights" widget (with Premium Analytics: make the post detail page a fixed composition #50488 applied it renders by default instead).