[Part 3] Add backend service for cart abandonment tracking
What does this MR do and why?
continuation of !212217 (merged)
This MR implements cart abandonment tracking to re-engage users who click upgrade buttons for Premium or Ultimate plans but don't complete the purchase. When a user clicks upgrade, the system schedules a delayed check (2 hours 50 minutes later) to see if they completed the purchase. If not, a lead is sent to marketing for follow-up email campaigns. It includes a feature flag for gradual rollout, job deduplication to prevent duplicate API calls, and comprehensive test coverage. The feature is disabled by default and can be rolled out gradually on GitLab.com to help recover lost revenue from users who abandon their upgrade flow.
References
#577574
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
Setup
- Ensure CDot is set up locally and running
- User must be logged in
- User must have
onboarding_status_email_opt_in: true - User must be a group owner/admin
- Feature flag enabled:
Feature.enable(:track_cart_abandonment)
Validation
- Navigate to the billing page
http://localhost:3000/groups/<group-path>/-/billing/subscriptions - Click "Upgrade to Premium" or "Upgrade to Ultimate" button
- Verify in Sidekiq
- Open
http://localhost:3000/admin/sidekiq - Check the
scheduledsection - Confirm the
CartAbandonmentWorkerjob is scheduled for 2h 50m from now
- Open
- Test the worker execution
- Either wait 2h 50m or manually trigger it in Rails console:
GitlabSubscriptions::CartAbandonmentWorker.new.perform(user_id, namespace_id, 'cart abandonment - SaaS Premium', 'free')
- Verify CDot received the parameters
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #577574