feat(cards): feed-card impressions stat behind a flag (real data only)#6260
Open
tsahimatsliah wants to merge 3 commits into
Open
feat(cards): feed-card impressions stat behind a flag (real data only)#6260tsahimatsliah wants to merge 3 commits into
tsahimatsliah wants to merge 3 commits into
Conversation
Adds a per-post impressions stat (analytics icon + count) to the feed card action bars (glass + standard V1/V2) and the post page stats strip, gated behind a new `card_impressions` GrowthBook flag (default off). - Real data only: getPostImpressions returns analytics.impressions ?? views, or null when neither is present — no mock/fabricated numbers. The stat is hidden when there is no real count. - X/Twitter-style compact formatting (formatImpressions): a decimal shows only under 10 (1.2K, 1.8M) and is dropped at double digits (12K, 45M). Wired via a new optional `format`/`countFormat` override on InteractionCounter/CardAction. - usePostImpressions centralises the flag + value; each bar renders the stat only when showImpressions is true. Click routes the owner/team to the post analytics page and everyone else to an explainer popup (PostImpressionsModal). - Post stats strip: with the flag on, impressions sit next to the other counts and link to analytics; with the flag off the strip is unchanged from main (author/team analytics.impressions line + "Post analytics" button preserved). Carried polish from the mock-up (applies regardless of the flag): glass-bar compaction, hero-title auto-fit (useFitFontSize), QuaternaryButton label set to font-medium per the button typography guideline, InteractionCounter vertical centering, downvote reordered to match the glass bar, and feed awards hidden below laptop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ards, strip routing
- formatImpressions: carry to the next unit when rounding lands on 1000
(999_500 → 1M, not 1000K). Add an impressions.spec covering the formatter and
getPostImpressions.
- Hide the impressions stat at zero (count > 0), matching the upvote/comment
counters and fixing the v2 CardAction rendering a bare icon at 0 while the
glass/standard bars showed "0".
- Scope the "hide awards below laptop" change to the card_impressions flag so
the control cohort keeps awards on every viewport (no flag-off regression).
- Post stats strip: route the impressions click through usePostImpressionsModal
(owner/team → analytics page, others → explainer) instead of always linking
everyone to the author-only analytics page.
- usePostImpressionsModal: navigate to the absolute ${webappUrl}posts/.../analytics
URL so it also works outside the webapp origin (extension), matching every
other analytics link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Changes
Engineering-ready port of the design mock-up #6237. Adds a per-post impressions stat (analytics icon + count) to the feed card action bars and the post page stats strip, gated behind a new
card_impressionsGrowthBook flag (default off).Impressions stat
PostUpvotesCommentsCount).getPostImpressionsreturnsanalytics.impressions ?? views, ornullwhen neither is present. There is no mock/fabricated data (the mock-up's hash-based fallback was dropped). The stat is hidden when there is no real count.formatImpressions): a decimal only shows under 10 (1.2K,1.8M) and is dropped at double digits (12K,45M). Plumbed via an optionalformat/countFormatoverride onInteractionCounter/CardAction(upvotes/comments keep their existing formatting).usePostImpressionscentralises flag + value; each bar renders the stat only whenshowImpressionsis true. Click routes the owner/team → post analytics page, everyone else → an explainer popup (PostImpressionsModal).Gating & no regressions
card_impressions(defaultfalse) — seefeatureManagement.ts. GrowthBook ramps it.analytics.impressionsline and the blue "Post analytics" button are preserved. With the flag on, impressions move next to the other counts and link to analytics.Carried polish from the mock-up (applies regardless of the flag, per request to port the full mock-up):
useFitFontSize).QuaternaryButtonlabelfont-bold → font-mediumper the button typography guideline.InteractionCountervertical centering in its fixed-height box.Context
#4978 deliberately replaced public
viewswith author/team-onlyanalytics.impressions. There is no real public impressions count yet (post.viewsis empty from the feed). So this ships behind a flag, real-data-only — in practice the stat is visible to authors/team on their own posts today, and lights up everywhere once the API exposes a public count. No fabricated numbers reach production.Experiment
New flag
card_impressions, defaultfalse.Events
No new tracking events.
Manual Testing
Strict typecheck (changed files) + ESLint clean. Full shared (1845) and webapp (289) Jest suites pass. Force the
card_impressionsflag on in GrowthBook devtools to review the stat on the feed cards and post page.Preview domain
https://claude-feed-card-impressions-eng.preview.app.daily.dev