feat: track post-signup activity on customer subsites (issue #399)#416
feat: track post-signup activity on customer subsites (issue #399)#416superdav42 merged 1 commit intomainfrom
Conversation
Adds Post_Signup_Activity_Manager that hooks into WordPress multisite actions on customer subsites and records events against the WU site object (object_type='site', object_id=blog_id) so they appear in the existing site edit page Events widget. Tracked actions: - Post creation (transition_post_status → publish) - Custom post type entry creation (same hook, non-post/page types) - User added to subsite (add_user_to_blog) - WooCommerce order created (woocommerce_new_order) Each event carries site + membership payload so admins can see per-subsite activity metrics from the network admin. Four new event types registered: subsite_post_created, subsite_cpt_created, subsite_user_registered, subsite_woocommerce_order Closes #399
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
…ty_Manager) Post_Signup_Activity_Manager was merged into main in #416 before this branch was rebased. Remove the duplicate Activity_Tracker class and its instantiation from class-wp-ultimo.php. Update Dashboard_Statistics::get_data_site_activity() to use the event slugs produced by Post_Signup_Activity_Manager (subsite_post_created, subsite_cpt_created, subsite_user_registered, subsite_woocommerce_order) instead of the now-removed Activity_Tracker slugs. Update Signup_Metrics_Test to match the corrected slugs.
* feat: add signup flow metrics and post-signup activity tracking (#297, #398) Implements two new tracking classes: - Signup_Metrics: hooks into the checkout lifecycle to record checkout_started, checkout_step_completed, checkout_completed, and checkout_failed events in the wu_events table. Each event type is also registered for webhooks and email triggers. - Activity_Tracker: hooks into sub-site WordPress actions to record site_post_published, site_user_registered, and site_woocommerce_order events for any customer-owned sub-site. Only tracks sites managed by WP Ultimo (via wu_get_site_by_blog_id). Dashboard_Statistics gains two new data methods: - get_data_signup_funnel(): returns per-stage counts + conversion rate - get_data_site_activity(): returns post/user/order counts per date range Both classes are wired up in class-wp-ultimo.php alongside the existing Tracker singleton. Tests cover singleton behaviour, event type registration, filter pass-through, and dashboard statistics key structure. Closes #297 Closes #398 * ci: re-trigger E2E tests * fix: remove duplicate Activity_Tracker (covered by Post_Signup_Activity_Manager) Post_Signup_Activity_Manager was merged into main in #416 before this branch was rebased. Remove the duplicate Activity_Tracker class and its instantiation from class-wp-ultimo.php. Update Dashboard_Statistics::get_data_site_activity() to use the event slugs produced by Post_Signup_Activity_Manager (subsite_post_created, subsite_cpt_created, subsite_user_registered, subsite_woocommerce_order) instead of the now-removed Activity_Tracker slugs. Update Signup_Metrics_Test to match the corrected slugs. * fix: correct wu_checkout_errors hook to prevent TypeError fatal error wu_checkout_errors is an action (not a filter) that fires with the checkout form name as a string argument (views/checkout/form.php:23). The previous implementation used add_filter and declared a return type of \WP_Error. When the action fired with a string argument, the method returned the string, causing a PHP TypeError (return type mismatch) that produced a fatal error on the /register page. Fix: - Change add_filter to add_action (correct hook type) - Change method signature to accept a string form name - Remove \WP_Error return type (void action callback) - Access checkout errors via Checkout::get_instance()->errors - Update test to verify string argument is accepted without error
Summary
Post_Signup_Activity_Managerthat hooks into WordPress multisite actions on customer subsites and records them as WU events linked to the originating site/membershipsubsite_post_created,subsite_cpt_created,subsite_user_registered,subsite_woocommerce_orderWhat was implemented
New file:
inc/managers/class-post-signup-activity-manager.phpHooks registered on
plugins_loaded(priority 20, non-main sites only):transition_post_statussubsite_post_createdtransition_post_statussubsite_cpt_createdadd_user_to_blogsubsite_user_registeredwoocommerce_new_ordersubsite_woocommerce_orderEach event carries
object_type='site'andobject_id=<blog_id>so it surfaces in the existing site edit page → Events widget without any new admin UI.Modified:
inc/class-wp-ultimo.php— registers the new manager afterSite_Manager.New test:
tests/WP_Ultimo/Managers/Post_Signup_Activity_Manager_Test.phpGuards
revision,auto-draft,nav_menu_item, etc.) are excludedAdmin view
Events are viewable at Network Admin → Sites → [site] → Events tab — this widget already filters by
object_type='site'andobject_id, so no changes to the admin UI were needed.Closes #399