Repository navigation
Connection: Record Tracks events on the new Safe Mode screen - #55183
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 7 files. Only the first 5 are listed here.
1 file is newly checked for coverage.
|
544f24f to
436d6a3
Compare
436d6a3 to
319e791
Compare
The new Safe Mode screen records when it is seen, when its questions and step-by-step guide are used, and when its actions start, succeed or fail. Every event goes through a new trackIdentityCrisisEvent() recorder, which adds the properties all Safe Mode events carry. With the new screen, the admin notice now identifies the viewer to Tracks, and the Connectors card's Disconnect records safe_mode_disconnect_site and jetpack_idc_disconnect_site, as the old Safe Mode panel did. Part of CONNECT-620. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
319e791 to
785137a
Compare
coder-karen
left a comment
There was a problem hiding this comment.
This looks good to me, thanks for taking this one on!
Approving as it's just nits I've left comments for. There was just one thing that I wanted to ask about, but not blocking:
When jetpack_idc_disconnect_site fires is different to before. The build plan comment suggests it should be sent from the same place as today - when the disconnect is confirmed. Now it runs after the disconnect succeeds. I left a it comment to suggest a readme wording change, perhaps that's al that is needed here, but wanted to flag this as it was different.
Separately another nit / question - jetpack_idc_guide_click - I'd suggested action: open | conclusion in the plan. Here it's open | later, and reaching a conclusion only shows up as a jetpack_idc_question_click answer with a guide path. Counting conclusions therefore means knowing which guide answers lead to a statement. Was dropping conclusion deliberate? If not, could it go alongside later?
- Send jetpack_idc_guide_click with action conclusion when a guide answer reaches a statement, with the statement as answer. - Have the flow return Tracks-shaped events (kind, action), so the screen passes them through. - Type the action events' action values as a literal union. - Docs: note when jetpack_idc_disconnect_site fires with the flag on, and which dialog events give exact counts; say when path is left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coder-karen thanks! Both points are addressed in 77e5f9e.
|
coder-karen
left a comment
There was a problem hiding this comment.
LGTM, thanks!
PCYsg-mUj-p2 should help for registering the new events.
Fixes CONNECT-620
Proposed changes
The new Safe Mode screen now records Tracks events. The screen is behind the
connection-idc-screenfeature flag, which is off by default. The admin notice, the My Jetpack window and the Connectors card all render it when the flag is on.Views:
jetpack_idc_notice_view, orjetpack_idc_non_admin_notice_viewfor a viewer who can't resolve Safe Mode. It's sent once per mount, the first time the screen is in the viewport while the tab is visible.Questions:
jetpack_idc_question_click, with thequestion, theanswerand thepathso far. It's sent:Picking an answer without Next sends nothing.
The guide:
jetpack_idc_guide_click, withactionopenwhen the guide is opened,conclusionwhen an answer reaches a statement, orlaterfor "Stay in Safe Mode for now". Aconclusionfollows that answer'sjetpack_idc_question_clickand carries the statement (old,originalorcopyof) asanswer.Actions: each action's start keeps the old screen's event name (
jetpack_idc_migrate,jetpack_idc_start_freshorjetpack_idc_confirm_safe_mode). Thenjetpack_idc_action_successorjetpack_idc_action_errorfollows. All three carry the flow'spath, which starts withguidewhen the admin got there through the guide.use_beacon, because the host may reload or leave the page right after it. Start fresh's success addsnew_blog_id.error_codeanderror_cause.The recorder: a new
trackIdentityCrisisEvent( event, context, props ), exported from the package, adds the properties every Safe Mode event carries:screen_version: 2,placement, from the screen'scontextprop,context, which is the admin screen id on the notice,platform, mapped fromsite.hostto the old screen's values,blog_id.Hosts (
packages/connection):jetpack_connection_card_action_clickwithaction: safe_mode_disconnect_site, as the old Safe Mode panel did, instead of the plaindisconnect_site. Once the dialog has disconnected the site and the admin leaves it, the card sendsjetpack_idc_disconnect_sitethrough the recorder. That is later than the old panel, which sent it on the confirm click, before the request.docs/connectors.mdnames the dialog's events that give exact counts.useIdentityCrisisActions()takes two new optional options,contextandisDevelopmentSite, for its events. The actions keep their signatures.ConnectionPlacementgainspage_modal.The README gains a "Safe Mode events" section listing every event and property, and
docs/connectors.mdpoints to it.Views and action starts keep the old screen's event names, so one query counts both screens, split by
screen_version.Related product discussion/links
{ entry, path }action argument from Connection: Add the question flow to the new Safe Mode screen #55143, and covers the step-by-step guide from Connection: Add the step-by-step guide to the new safe mode screen #55389.Does this pull request change what data or activity we track or use?
Yes, so this PR carries the
[Status] Needs Privacy Updateslabel. When the new Safe Mode screen is shown (it sits behind a feature flag that is off by default), it records the Tracks events listed above.dashboard), the site's hosting platform (woa,vip,newspackorself-hosted), its WordPress.com blog id, and whether it's a development or staging site. After Start fresh, the new blog id the site registered as is added.jetpack-idcMC stats. The old screen still does.Testing instructions
Unit tests
jp test js js-packages/connectionandjp test js packages/connection. These files pin the event payloads:hooks/use-identity-crisis-actions/test/index.test.ts: each action's start, success and error.components/identity-crisis/test/identity-crisis.test.tsx: the path from the screen, question and guide clicks, and views.helpers/test/connection-tracking.test.ts: the properties every event carries.packages/connection,src/identity-crisis/_inc/test/admin.test.jsx(the notice's identity) andsrc/connectors/js/test/connectors-card.test.js(the card's Disconnect).pnpm run typecheckinprojects/js-packages/connectionand inprojects/js-packages/ai-client. ai-client resolves this package's TypeScript withnodenext, so a relative import without a.tsextension breaks it even when this package's own check passes.On a site
Set up a connected Jetpack site running this branch:
add_filter( 'jetpack_feature_flag_enabled_connection-idc-screen', '__return_true' );in an mu-plugin.localStorage.debug = 'dops:analytics', and turn on Preserve log in the Console and Network panels.Then check:
jetpack_idc_notice_viewis logged, withcontext: dashboard,placement: page_noticeandscreen_version: 2. In the Network panel, itspixel.wp.com/t.gifrequest has_ut=wpcom:user_id, notanon. The block editor, where the notice is hidden, logs no view.jetpack_idc_question_clicktwice, withactionanswerand thenback. Picking an answer alone logs nothing.jetpack_idc_guide_click,action: open), answer "A site loads there" (jetpack_idc_question_clickwithquestion: open_address), then click "Stay in Safe Mode for now" (jetpack_idc_guide_click,action: later). Click Back, answer "A separate site", then the address WordPress.com has (not this site's). After that answer'sjetpack_idc_question_click,jetpack_idc_guide_clicklogsaction: conclusionwithanswer: original.jetpack_idc_confirm_safe_modeis logged, thenjetpack_idc_action_successwith the samepath, and the page reloads. Repeat an action with DevTools offline: it logsjetpack_idc_action_errorwitherror_codeanderror_cause, and no success.placement: page_modalandcontext: my-jetpack.placement: connection_card. Disconnect site logsjetpack_connection_card_action_clickwithaction: safe_mode_disconnect_site. Disconnect, then click "Back to WordPress":jetpack_idc_disconnect_siteis logged before the reload. This disconnects the site, so do it last.🤖 Generated with Claude Code