Skip to content

feat(cards): feed-card impressions stat behind a flag (real data only)#6260

Open
tsahimatsliah wants to merge 3 commits into
mainfrom
claude/feed-card-impressions-eng
Open

feat(cards): feed-card impressions stat behind a flag (real data only)#6260
tsahimatsliah wants to merge 3 commits into
mainfrom
claude/feed-card-impressions-eng

Conversation

@tsahimatsliah

@tsahimatsliah tsahimatsliah commented Jun 29, 2026

Copy link
Copy Markdown
Member

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_impressions GrowthBook flag (default off).

Impressions stat

  • New action on the glass feed bar, standard ActionButtons (V1 + V2), and the post page stats strip (PostUpvotesCommentsCount).
  • Real data onlygetPostImpressions returns analytics.impressions ?? views, or null when 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.
  • X/Twitter-style compact number (formatImpressions): a decimal only shows under 10 (1.2K, 1.8M) and is dropped at double digits (12K, 45M). Plumbed via an optional format / countFormat override on InteractionCounter / CardAction (upvotes/comments keep their existing formatting).
  • usePostImpressions centralises flag + value; each bar renders the stat only when showImpressions is true. Click routes the owner/team → post analytics page, everyone else → an explainer popup (PostImpressionsModal).

Gating & no regressions

  • The whole feature sits behind card_impressions (default false) — see featureManagement.ts. GrowthBook ramps it.
  • With the flag off, the post stats strip is byte-for-byte main: the author/team analytics.impressions line 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):

  • Glass-bar compaction (XSmall buttons / 16px icons, asymmetric optical padding).
  • Hero-title auto-fit so the TLDR stays visible (useFitFontSize).
  • QuaternaryButton label font-bold → font-medium per the button typography guideline.
  • InteractionCounter vertical centering in its fixed-height box.
  • Downvote reordered to match the glass bar; feed awards hidden below laptop.

Context

#4978 deliberately replaced public views with author/team-only analytics.impressions. There is no real public impressions count yet (post.views is 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, default false.

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_impressions flag 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

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>
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Jun 29, 2026 6:21am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored Jun 29, 2026 6:21am

Request Review

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant