Skip to content

Premium Analytics: Add a dismissible Upgrade to Parse.ly card to the Traffic tab - #55375

Draft
adamwoodnz wants to merge 19 commits into
trunkfrom
stats-657-promo-section-footer-placement
Draft

adamwoodnz wants to merge 19 commits into
trunkfrom
stats-657-promo-section-footer-placement

Conversation

@adamwoodnz

@adamwoodnz adamwoodnz commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes STATS-646
Fixes STATS-668

Why

A site owner on the Traffic tab who has outgrown what Stats counts has nowhere to go from the numbers themselves. The Parse.ly offer reaches them only through the Stats options menu and the Settings page, neither of which is beside the data the offer is about. This adds a dismissible card at the foot of the Traffic tab that says what Parse.ly measures that Stats does not, and links to signup. Closing it hides it for 90 days; closing it a second time hides it for good.

Nothing is visible yet on a real site: the card is behind the same gate as the other two Parse.ly prompts, and WordPress.com holds that gate shut.

Proposed changes

  • A section-footer placement (STATS-668). The promo names the section it attaches to as its target, in the namespaced form register_dashboard_section() takes, such as analytics/traffic. A bare slug is refused at registration.
  • The target is resolved to the section's slug when the promo is published, not when it is registered: the section registry hydrates on its own first read, and a registrant may run before it holds every section. A target naming no registered section is dropped at publish time with a _doing_it_wrong() naming both.
  • A promo can name a render_module, a script module that draws the card's content region and its heading. The card keeps the frame, the dismiss control, the snooze rule, the Tracks events and the promo's own copy as a fallback if the module never loads. The module reaches the page through the dashboard's import map, added by the same boot-dependency filter the widget modules use.
  • A promo can name an eyebrow, which the card draws in its header beside the dismiss control. Whichever of the eyebrow and the module is absent leaves the title to the header, so the card carries its heading exactly once however it is built.
  • A new internal package, parsely-promo-card, draws the Traffic card: the metrics headline, the feature badges and the call to action. Its three columns collapse to one on a narrow card, driven by a container query rather than the viewport, because the card's width comes from the dashboard grid and the collapsible admin menu.
  • The Parse.ly promo registry gains the Traffic card beside the existing menu and settings prompts, dismissible, snoozing for 90 days, behind the same offers_parsely_prompts gate as the other two.
  • usePromoSlot() takes the target it is drawing for, and keys its one-per-slot latch by placement and target, so two section footers on one page cannot claim each other's promo.
  • The SDK publishes PromoRecord, PromoRenderProps and the PromoCta component, so a promo module outside this package can draw the same button.

Screenshots

The card at the foot of the Traffic tab, drawn by its render module.

The card at full width, in three columns

Narrowed, the columns stack and the badges wrap.

The card narrowed, stacked into one column

Related product discussion/links

Does this pull request change what data or activity we track or use?

No new events. The three promo events already on trunk now also fire for section-footer, with placement set to it, and the card's module records its own clicks through the same event with label set to cta or features.

Testing instructions

The card is gated on offers_parsely_prompts, which requires a plan tier, a views threshold, no Parse.ly integration already installed, and a WordPress.com flag that is currently false for every site. Force it open with a mu-plugin:

add_filter( 'jetpack_premium_analytics_offers_parsely_prompts', '__return_true' );
  • Open the dashboard and the Traffic tab. The card sits at the foot of the section, below the last widget: an eyebrow and a dismiss control on one row, then the headline and pitch, the metrics line and feature badges, and the Upgrade to Parse.ly button.
  • The feature badges are drawn only by the render module, never by the card's fallback copy. Their presence is the proof that the module resolved and mounted.
  • Narrow the window. The three columns stack and the badges wrap within their column.
  • Click Dismiss. The card goes and stays gone over a reload. It is a snooze, not a final dismissal: wp_persisted_preferences records {"count":1,"final":false} for parsely/traffic-upgrade under jetpack-premium-analytics/dashboard → dismissedPromos. Clearing that record brings the card back.
  • Open the Stats options menu and choose Customize. The card stands down while the layout is being arranged and returns on Done.
  • Register a section-footer promo with 'target' => 'traffic' instead of 'analytics/traffic': registration is refused with a notice naming the expected form.

Verified

  • 240 Jest suites / 5209 tests pass; PHPUnit 1015 tests pass. Typecheck, ESLint, stylelint and PHPCS are clean.
  • The card was exercised in a browser on a local Jetpack site: it renders at the foot of the Traffic tab drawn by its module, every string is present, the three-column layout collapses and the badges wrap, and the first close recorded a snooze rather than a final dismissal.
  • The second close that sets final: true was not exercised in a browser. It would need the 90-day snooze faked out, and it is pre-existing behaviour with its own tests.
  • Phan never ran locally — it crashes in this environment parsing the WordPress stubs, unrelated to this branch. The static analysis on the new PHP is unverified until CI runs it here.
  • A promo that names a module, carries no eyebrow and is not dismissible would render an empty card header. No promo does that today, and the fix belongs with whichever one first wants it.
  • Nothing ties PARSELY_PROMO_CARD_MODULE_ID to the module id wp-build emits. They agree today; if the build's naming changes, the card falls back to its own copy rather than failing loudly.

🤖 Generated with Claude Code

@adamwoodnz adamwoodnz added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Nov 24, 2026
@adamwoodnz adamwoodnz self-assigned this Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the stats-657-promo-section-footer-placement branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack stats-657-promo-section-footer-placement
bin/jetpack-downloader test jetpack-mu-wpcom-plugin stats-657-promo-section-footer-placement

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Premium Analytics plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Stats Data plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 9 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/packages/sdk/src/conformance.ts 0/9 (0.00%) 0.00% 1 ❤️‍🩹
projects/packages/premium-analytics/src/class-promo-registry.php 40/44 (90.91%) -0.52% 1 ❤️‍🩹
projects/packages/premium-analytics/src/promos.php 27/48 (56.25%) 16.86% 1 ❤️‍🩹
projects/packages/premium-analytics/packages/data/src/utils/promos.ts 13/13 (100.00%) 0.00% 0 💚
projects/packages/premium-analytics/packages/widgets-toolkit/src/components/promo-card/promo-card.tsx 49/50 (98.00%) 1.03% 0 💚

2 files are newly checked for coverage.

File Coverage
projects/packages/premium-analytics/packages/parsely-promo-card/src/index.tsx 6/6 (100.00%) 💚
projects/packages/premium-analytics/packages/widgets-toolkit/src/components/promo-card/types.ts 0/0 (—%) 🤷

Full summary · PHP report · JS report

@adamwoodnz
adamwoodnz force-pushed the stats-657-add-a-promo-slot-extension-api-to-premium branch from a925980 to 993a260 Compare November 25, 2026 20:45
Base automatically changed from stats-657-add-a-promo-slot-extension-api-to-premium to trunk November 26, 2026 03:13
… card

Record the dismissible Upgrade to Parse.ly card in the package and the three plugins that load it, and update the promo note in AGENTS.md for section-footer targets and render modules.
Eight call sites each kept their own hand-written copy of the twelve-field
promo payload, and they had already drifted: the dashboard stage's copy was
missing cta_variant, which a loose Record type hid. One factory in tests/js,
beside the package's other shared mocks, leaves one place to add a field.

The Parse.ly Traffic payload joins it, so the test and the story that need the
registration's own copy read it from one place rather than two.

Also restores window.JetpackScriptData after the stage's promo tests, which
only got away with leaking it because that block runs last in the file.
The per-load closed latch was keyed by placement alone, so closing the Traffic
card would have closed the footer of every other section for that load too.
Inert while one section-footer promo is registered, wrong as soon as a second
is, and free to fix now.

Also puts the only bare English literal among the package's _doing_it_wrong()
messages behind __(), trims a promo's target as the other string fields are
already trimmed, so a padded one is not refused with a message about a pattern
it looks like it matches, and brings the comment above the promo slot's boot
line up to date with the footer placement.
A reader entering the Parse.ly card met the same sentence three times: the
landmark's name, a visually hidden h3 the frame kept so the card stayed in the
heading outline, and the module's own visible h4 carrying a second copy of the
string. It was also the last user-visible string the branch left written out in
both PHP and JS, with nothing to catch the two drifting apart.

The frame now names the card from the registered title and renders a heading
only when it draws the content itself. A module owns the heading of the region
it draws, and reads the title off the promo rather than carrying one, so the
string is registered in one place. The copy the frame falls back to carries a
heading whenever a module was expected, which covers the instant before the
module arrives and both ways it can fail to draw.

The new test is the only one that mounts the module inside the real frame, with
the payload the registration publishes, and it counts the headings: one, in
every state. The PHP side pins the title in the registration test, which is now
what guards it.

The 30+ metrics placeholder is renamed to <strong>, which is what it renders as.
A translator reading <em> would have expected italics.
The SDK's type declarations changed on this branch, and that project has its own
changelog gate: without an entry of its own the pre-push hook and the linting
CI job both refuse the branch.

The entries said "Traffic section", which is our word for it. A reader sees a
tab, which is the word the Stats plugin's own entries use.

The Stats plugin's entry takes the Premium Analytics prefix after all. Every
recent Premium Analytics entry in that changelog carries it, including features
that only exist there, and one CHANGELOG holding both conventions reads worse
than a prefix that repeats what the reader already knows.
The frame stops rendering a heading when a module draws, so the published contract and the package notes now say the module draws it from promo.title.

Also keep test support out of the Storybook graph by giving the promo stories their own fixtures, drop a stale comment about the placement latch, and restore IntersectionObserver after the Parse.ly card suite.
The list ends on "and much more", which named six capabilities and then
asked the reader to take the rest on trust. The only way on was the CTA,
which opens a signup form: a reader who wants to know what the rest is
before they buy had nowhere to go.

It points at the Jetpack landing page Parse.ly maintains, and reports as
"features" so its clicks can be told apart from the CTA's.
A single column put the pitch, the metrics and the call to action one
under another, so on a wide dashboard the card ran to the depth of a
section's worth of widgets for six short lines of copy, and the reader
had to travel the whole height to reach the button.

The pitch, the metrics and the button now sit side by side once the card
has the room for them, and stack again when it does not. The feature
names become badges that wrap within their own column rather than a
bulleted list that only ever ran downwards.

A container query decides this, not the viewport: the card's width is set
by the dashboard's own grid and the collapsible admin menu, neither of
which the window size predicts.
@adamwoodnz
adamwoodnz force-pushed the stats-657-promo-section-footer-placement branch from 45cf5dd to e13ccc4 Compare November 30, 2026 22:59
@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Stats Data labels Nov 30, 2026
The Parse.ly card's kicker lived in its render module, which fills the
card's content region. The dismiss control is frame chrome and sits in
the header above that region, so the two could never share a row and the
card opened on a line holding nothing but a close button.

A promo can now register an eyebrow, and the frame draws it in the header
beside the dismiss. Whichever of the eyebrow and the module is absent
leaves the title to the header, so a card still carries its heading
exactly once however it is built.
@adamwoodnz adamwoodnz changed the title Premium Analytics: Add the section-footer promo placement Premium Analytics: Add a dismissible Upgrade to Parse.ly card to the Traffic tab Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs Enhancement Changes to an existing feature — removing, adding, or changing parts of it [JS Package] Premium Analytics Sdk [Package] Premium Analytics [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Premium Analytics [Plugin] Stats Data RNA [Status] In Progress [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant