Skip to content

Conversation

@jsoningram
Copy link
Contributor

@jsoningram jsoningram commented Oct 28, 2025

Asana Task/Github Issue: FE/XP: implement CPM stats in NTP
Figma: O-E CPM

Description

This PR introduces cookie pop-up blocking stats to the New Tab Page (NTP), along with a redesigned activity tracker details display. The changes include support for legacy platforms through derived feature flagging to ensure backwards compatibility during the rollout.

New UI Components

  • TickPill (special-pages/pages/new-tab/app/components/TickPill/): A reusable pill component with optional checkmark icon for displaying status information
  • Tooltip (special-pages/pages/new-tab/app/components/Tooltip/): A tooltip component for displaying additional contextual information

Legacy Platform Support

To support platforms not yet ready for the new protections report, legacy versions of components were created:

  • ActivityItemLegacy: Legacy activity item component
  • TrackerStatusLegacy: Legacy tracker status display (icon-based)
  • ProtectionsHeadingLegacy: Legacy protections heading
  • ActivityLegacy.module.css: Legacy styling for activity components
  • PrivacyStatsLegacy.module.css: Legacy styling for privacy stats

Components now accept a shouldDisplayLegacyActivity prop to toggle between new and legacy UI. This allows for gradual rollout across platforms. When all platforms are ready, we can remove the ‘legacy’ support files. Search for @todo legacyProtections to locate usage. NOTE Also see activity_ and stats_ translation strings for legacy support

Before After
image image
image image

Testing Steps

Append the following query parameters to the Base URL to simulate…

  • CPM = 0 state: ?cpm=none
  • No data: ?stats=none (sets trackers blocked to 0, hiding summary and details)
  • Support for platforms that aren’t ready for the new updates: ?cpm=undefined

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

Note

Adds cookie pop-up blocking stats to the Protections Report and per-site indicators in Activity, with legacy UI fallback, new components, schemas/types, and tests.

  • Protections Report (Summary view):
    • Show CPM stats via totalCookiePopUpsBlocked with new heading layout, info tooltip, and temporary NewBadgeIcon.
    • Conditional legacy heading ProtectionsHeadingLegacy when CPM data is undefined.
    • Provider/signals updated to stream CPM counts; styling tweaks in PrivacyStats.module.css.
  • Activity (Details view):
    • Support per-site cookiePopUpBlocked and render status pills using new TickPill.
    • Split UI: ActivityItem (new) vs ActivityItemLegacy + TrackerStatusLegacy controlled by shouldDisplayLegacyActivity.
    • Normalization updated to include cookiePopUpBlocked.
  • New shared components/icons:
    • TickPill, Tooltip, InfoIcon, NewBadgeIcon, Check, FireIcon (and usage swap in controls).
  • Schemas/Types/Mocks:
    • Extend activity/protections schemas and TS types with cookiePopUpBlocked and totalCookiePopUpsBlocked.
    • Update mock transports and datasets to emit new fields; theme variables expanded.
  • Tests:
    • Integration tests for CPM stats visibility and per-item cookie pop-up indicators.
  • Docs:
    • Update activity.md and protections.md payload examples to include new fields.

Written by Cursor Bugbot for commit 02438b3. This will update automatically on new commits. Configure here.

@netlify
Copy link

netlify bot commented Oct 28, 2025

Deploy Preview for content-scope-scripts failed.

Name Link
🔨 Latest commit 02438b3
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/6902b70a81e53e0008cea841

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

[Beta] Generated file diff

Time updated: Thu, 30 Oct 2025 00:54:23 GMT

Apple
    - apple/pages/history/dist/index.css
  • apple/pages/new-tab/dist/index.css
  • apple/pages/new-tab/dist/index.js
  • apple/pages/new-tab/locales/en/new-tab.json
  • apple/pages/release-notes/dist/index.css
  • apple/pages/special-error/dist/index.css
  • apple/pages/special-error/index.html

File has changed

Integration
    - integration/pages/example/dist/index.css
  • integration/pages/history/dist/index.css
  • integration/pages/new-tab/dist/index.css
  • integration/pages/new-tab/dist/index.js
  • integration/pages/new-tab/locales/en/new-tab.json
  • integration/pages/release-notes/dist/index.css
  • integration/pages/special-error/dist/index.css

File has changed

Windows
    - windows/pages/history/dist/index.css
  • windows/pages/new-tab/dist/index.css
  • windows/pages/new-tab/dist/index.js
  • windows/pages/new-tab/locales/en/new-tab.json
  • windows/pages/release-notes/dist/index.css
  • windows/pages/special-error/dist/index.css
  • windows/pages/special-error/index.html

File has changed

@shakyShane
Copy link
Contributor

@jsoningram amazing. This approach is really good because when both platforms support it, we can delete a bunch of code and we're not left with overly-configurable components. Excellent work - sorry it creates a much larger PR, but this will pay off for certain!

@jsoningram jsoningram force-pushed the jingram/cpm-stats-on-ntp branch from fc51da1 to c8ad930 Compare October 29, 2025 18:49
@jsoningram jsoningram marked this pull request as ready for review October 29, 2025 18:51
@jsoningram jsoningram requested review from a team, mgurgel and shakyShane as code owners October 29, 2025 18:51
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@jsoningram jsoningram force-pushed the jingram/cpm-stats-on-ntp branch from 7ea3c94 to e596630 Compare October 30, 2025 00:37
gap: 6px;
padding: 8px 10px;
border-radius: 100px;
background-color: rgba(255, 255, 255, 0.03);
Copy link
Contributor

@mgurgel mgurgel Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and most other color and spacing values are covered in https://github.com/duckduckgo/content-scope-scripts/blob/main/special-pages/shared/styles/variables.css which IIRC comes for free in new-tab components

The 84% black is particularly repetitive across our CSS. No actual harm in keeping them like this, but I'm seeing variables being consistently used in other new-tab styles.

}

.text {
font-size: 11px;
Copy link
Contributor

@mgurgel mgurgel Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to flag this one too, but I'm seeing inconsistent implementations across new-tab:

  • ntp-theme.css defines --small-label-font-size: 11px;
  • NextSteps.module.css uses the pattern font-size: calc(11 * var(--px-in-rem));

@shakyShane might be able to tell which one is the official steer.

faviconMax: item.favicon?.maxAvailableSize ?? DDG_DEFAULT_ICON_SIZE,
favoriteSrc: item.favicon?.src,
trackersFound: item.trackersFound,
// cookiePopUpBlocked: item.cookiePopUpBlocked,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this left here on purpose?

Copy link
Contributor

@mgurgel mgurgel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good work @jsoningram! I like how you've made it really easy to delete legacy code in the future :)

Mostly minor issues to flag:

  • Potentially blocking translation key mismatch (see Cursor's comment)
  • Commented-out line that should either be removed or explained
  • Couple questions about the use of CSS variables, but only for consistency - no visible impact
  • A tiny lint error for an unused Fire icon that's breaking CI

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.

3 participants