Skip to content

Premium Analytics: Add a dismissable Upgrade to Parse.ly card below the Traffic widgets - #55251

Open
dognose24 wants to merge 5 commits into
trunkfrom
add/stats-646-parsely-upgrade-card
Open

dognose24 wants to merge 5 commits into
trunkfrom
add/stats-646-parsely-upgrade-card

Conversation

@dognose24

@dognose24 dognose24 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Part of STATS-646

Proposed changes

  • Add a dismissable "Upgrade to Parse.ly" card at the bottom of the Traffic tab in Stats. It carries a headline, a short list of what Parse.ly adds, and a button that opens the Parse.ly signup in a new tab.
  • The card is rendered by the dashboard stage, below the widget grid. It is not a registered widget, so it does not appear in Customize or in the widget inserter and cannot be moved, resized or removed there.
  • The ✕ in the card's header snoozes it: the first close hides it for 90 days, the second hides it for good. The dismissal is stored per user, in the dashboard's preferences, as { count, at }.
  • The button opens https://dash.parsely.com/self-serve with utm_source=jetpack, the site title as publisher_name and the site's host as site_domain, the parameters the signup page reads. The server builds that URL (parsely_signup_url(), from get_bloginfo( 'name' ) and home_url()) and ships it in the script data as premium_analytics.parsely_signup_url, so the link is right on first paint and the client reads no site record for it.
  • The card shows only when the server publishes premium_analytics.offers_parsely_prompts and the signup URL in the script data. That value comes from Premium Analytics: Decide which sites and users see the Upgrade to Parse.ly prompts #55232 (STATS-645), which is still open, so on trunk this PR shows nothing yet.
  • It is hidden while customizing and on a locked section.

Screenshots

Colors follow the admin color scheme: blue on the default scheme, green on others.

Wide Narrow
The card below the Traffic widgets, three columns The card at a narrow width, one column

Open points

  • "and much more" is plain text; the design has it as a link to a page on the Parse.ly site that is not published yet.
  • A shared promo slot is being designed in STATS-657. Once it exists, this card moves from the stage to that slot and its code into a Parse.ly package; the component, dismiss and Tracks events stay as they are.
  • jetpack-script-data.d.ts declares the same offers_parsely_prompts field as Premium Analytics: Decide which sites and users see the Upgrade to Parse.ly prompts #55232, and both PRs add a require_once block to load_dashboard_components(), so whichever merges second needs a trivial conflict resolution.

Related product discussion/links

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

Yes. It adds three Tracks events, each with source: traffic_card:

  • jetpack_premium_analytics_parsely_upgrade_view: the card was shown, recorded once per page load.
  • jetpack_premium_analytics_parsely_upgrade_click: the reader clicked "Upgrade to Parse.ly".
  • jetpack_premium_analytics_parsely_upgrade_dismiss: the reader closed the card, with dismissal: snooze the first time and dismissal: final the second.

The signup link passes the site title and host to the Parse.ly signup page as query parameters.

Testing instructions

  • Check out this branch and build: jp build packages/premium-analytics
  • Make the site qualify. Until Premium Analytics: Decide which sites and users see the Upgrade to Parse.ly prompts #55232 lands, publish the value from a mu-plugin:
    add_filter(
    	'jetpack_admin_js_script_data',
    	function ( $data ) {
    		$data['premium_analytics']['offers_parsely_prompts'] = true;
    		return $data;
    	},
    	30
    );
  • Open Stats and stay on the Traffic tab. Scroll to the bottom: the card "The next step after Stats" sits below the last widget, full width. The copy and the button say "Parse.ly".
  • Narrow the window. The three columns stack into one and nothing overflows.
  • Click "Upgrade to Parse.ly". The signup opens in a new tab with publisher_name set to the site title and site_domain to the site's host.
  • Open the Stats options menu and choose Customize. The card is hidden, and it is not offered under "Add widget". Cancel.
  • Switch to another tab (e.g. Insights). The card is not there.
  • Back on Traffic, click the ✕. The card goes away and stays away after a reload.
  • To see it come back after the snooze, back-date the stored dismissal with WP-CLI (user ID and prefix as on your site) and reload:
    wp eval 'global $wpdb; $u = 1; $k = $wpdb->get_blog_prefix() . "persisted_preferences"; $p = (array) get_user_meta( $u, $k, true ); $p["jetpack-premium-analytics/dashboard"]["parselyUpgradeCardDismissal"] = array( "count" => 1, "at" => "2026-01-01T00:00:00.000Z" ); $p["_modified"] = gmdate( "Y-m-d\\TH:i:s\\Z" ); update_user_meta( $u, $k, $p );'
    The card is back. Click the ✕ again: it is gone for good, and the stored record now has count: 2. Unset the key the same way to start over.
  • Remove the mu-plugin and reload on a fresh user. No card.
  • Tests: jp pnpm -C projects/packages/premium-analytics run test -- parsely stage

Verified on this branch

  • Jest (card, signup URL, site hooks, stage: 84 tests), tsc --noEmit and ESLint pass. PHPUnit covers the signup URL (site filled in, no site name, other admin pages); PHPCS is clean.
  • Local Docker site, July 2026 window: the card renders as in the screenshots, the signup link carries publisher_name and site_domain, the first ✕ stores { count: 1, at } and hides the card across reloads, a back-dated record brings it back, the second ✕ stores count: 2 and hides it for good, and removing the record shows it again.

🤖 Generated with Claude Code

@dognose24 dognose24 added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Status] Needs Privacy Updates Our support docs will need to be updated to take this change into account labels Nov 19, 2026
@dognose24 dognose24 self-assigned this Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 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), and enable the add/stats-646-parsely-upgrade-card branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/stats-646-parsely-upgrade-card

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

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!

@jp-launch-control

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

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/routes/dashboard/hooks/constants.ts 2/2 (100.00%) 0.00% 0 💚
projects/packages/premium-analytics/src/class-analytics.php 206/221 (93.21%) 0.06% 0 💚

4 files are newly checked for coverage.

File Coverage
projects/packages/premium-analytics/src/parsely-signup-url.php 17/18 (94.44%) 💚
projects/packages/premium-analytics/routes/dashboard/components/parsely-upgrade-card/parsely-upgrade-card.tsx 38/39 (97.44%) 💚
projects/packages/premium-analytics/packages/data/src/utils/parsely-prompts.ts 2/2 (100.00%) 💚
projects/packages/premium-analytics/routes/dashboard/components/parsely-upgrade-card/index.ts 0/0 (—%) 🤷

Full summary · PHP report · JS report

@dognose24
dognose24 marked this pull request as ready for review November 19, 2026 14:39
@dognose24
dognose24 requested a review from a team as a code owner November 19, 2026 14:39
@dognose24 dognose24 added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Nov 19, 2026
dognose24 and others added 4 commits November 23, 2026 10:21
…e Traffic widgets

STATS-646

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…aws it

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… card

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e signup page's own parameters

Name the product "Parse.ly" wherever a reader sees it. The first close hides the card for 90 days and the second for good; the dismiss event says which. The signup link now sends the site title as `publisher_name` and the host as `site_domain`, the parameters the page reads.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dognose24
dognose24 force-pushed the add/stats-646-parsely-upgrade-card branch from 415e08d to 6b2a7c1 Compare November 23, 2026 02:34
@dognose24 dognose24 changed the title Premium Analytics: Add a dismissable Upgrade to Parsely card below the Traffic widgets Premium Analytics: Add a dismissable Upgrade to Parse.ly card below the Traffic widgets Nov 23, 2026
@adamwoodnz

adamwoodnz commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Non-blocking notes on how this will port to the promo slot API in STATS-657, which lets another package register a card into the dashboard rather than Premium Analytics carrying the card itself.

The dismissal model here needs no changes at all. { count, at }, two closes then final, an unreadable date failing closed, and the 90 day snooze are exactly what the shared helper does, with the snooze window as a parameter. It was lifted from this PR.

One request, and it is worth doing on its own merits rather than for the port: build the signup URL in PHP instead of at render time. get_bloginfo( 'name' ) and the host from home_url() are both available there, so the finished URL can ship in the payload. That drops two useSelect calls, gives a correct href on first paint instead of after the site record resolves, and avoids adding useSiteTitle to the data package's public barrel for a single caller. A hook in that barrel is harder to withdraw later than an internal one.

Two things the port deletes, mentioned so they are not a surprise rather than as change requests. offers_parsely_prompts and offersParselyPrompts() go away, because the slot API gates eligibility server side and an ineligible promo never reaches the browser at all. The enabled prop goes too, splitting into the promo's registered target section and the placement's own edit mode and locked section handling.

The larger part is structural. This card is richer than a title, a description and a button, so under the slot API it registers a render module and the component moves to the promoting package, which is the dependency inversion STATS-657 exists for. The frame then owns Card.Root, the header, the title, the close control, the dismissal write and the view tracking, so the module keeps what sits inside Card.Content. One consequence worth knowing early: "The next step after Stats" becomes the registered title in PHP while "You've outgrown counting." stays in the module, so the copy ends up split across two places. The Tracks event names also become the generic promo ones, with the slug identifying this card, so the current funnel loses continuity at the port.

The dashboard ships the finished URL in its script data, with the site title as `publisher_name` and the host as `site_domain`, so the card's link is right on first paint and the client reads no site record for it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dognose24

Copy link
Copy Markdown
Contributor Author

Thanks, the port notes are clear. Taken the one request in the latest commit: parsely_signup_url() builds the URL in PHP from get_bloginfo( 'name' ) and the host of home_url(), and load_dashboard_components() ships it as premium_analytics.parsely_signup_url. The card reads that and shows only when it is there; useSiteTitle is gone from the data barrel and getParselySignupUrl() is now a script-data read. PHPUnit covers the URL (site filled in, no site name, other admin pages).

Good to hear the dismissal model carried over as is. On the port deleting offers_parsely_prompts, enabled and renaming the Tracks events: no objection, and the split copy is fine; whoever lands the port can note the event rename in the PR so the funnel break is on record.

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work on the two-step snooze! @dognose24 I tested it on a qualifying site and the snooze and final close work nicely. A few inline notes below.

Comment on lines +636 to +638
enabled={
! editMode && ! isSectionLocked && section.slug === 'traffic'
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we also wait for onboarding.phase === 'closed' here, like FeedbackBanner above? On a first visit the card mounts under the welcome modal, so parsely_upgrade_view fires before the reader can see it. The STATS-657 frame may want the same gate.

Suggested change
enabled={
! editMode && ! isSectionLocked && section.slug === 'traffic'
}
enabled={
! editMode &&
! isSectionLocked &&
section.slug === 'traffic' &&
onboarding.phase === 'closed'
}

$args = array_filter(
array(
'utm_source' => 'jetpack',
'publisher_name' => get_bloginfo( 'name' ),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we decode the site title here? WordPress stores blogname HTML-escaped, so a site named Tom & Jerry's News sends publisher_name=Tom &amp; Jerry&#039;s News to the signup page.

Suggested change
'publisher_name' => get_bloginfo( 'name' ),
'publisher_name' => wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),

trackEvent( 'jetpack_premium_analytics_parsely_upgrade_view', { source: TRACKS_SOURCE } );
}, [ isVisible, trackEvent ] );

const dismiss = useCallback( () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Heads-up rather than a change request: after closing the card, focus falls back to <body>, so a keyboard user starts over from the top. FeedbackBanner does the same, so maybe a shared follow-up?

Comment on lines +217 to +222
{ features.map( feature => (
<Text
key={ feature }
render={ <li /> }
variant="body-sm"
className={ styles.feature }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Would it be worth using Badge for these pills instead of the custom .feature style? It's already in externals and would drop the hard-coded 9999px and 2px. It uses an 8px radius and the info color, though, so this may be a design call.

<li key={ feature }>
	<Badge intent="informational">{ feature }</Badge>
</li>

@adamwoodnz

Copy link
Copy Markdown
Contributor

We've been asked to hold this for now, so I'm not sure it makes sense to merge this, given long term it will use the promo slot API.

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

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Package] Premium Analytics [Status] Needs Privacy Updates Our support docs will need to be updated to take this change into account [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants