Skip to content

Track viewing the Coupons tab#2950

Open
truongwp wants to merge 2 commits intomasterfrom
coupons-tab-usage-tracking
Open

Track viewing the Coupons tab#2950
truongwp wants to merge 2 commits intomasterfrom
coupons-tab-usage-tracking

Conversation

@truongwp
Copy link
Copy Markdown
Contributor

@truongwp truongwp commented Feb 11, 2026

This tracks the number of times the Coupons tab is viewed in Lite when the Coupons add-on isn't activated.

This also fixes a fatal error when cleaning the usage data when the $value is not a string.

Coupons PR: https://github.com/Strategy11/formidable-coupons/pull/21

Summary by CodeRabbit

  • Bug Fixes

    • Improved email placeholder detection to properly handle non-string values, enhancing stability.
  • Chores

    • Added usage analytics tracking for coupons tab interactions to monitor feature adoption.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Two targeted improvements: a defensive string-type check added to email-detection logic in the usage model to prevent type errors, and a usage tracking call inserted into the coupons upsell view to record tab-view events.

Changes

Cohort / File(s) Summary
Email Detection Guard
classes/models/FrmUsage.php
Added string-type check before str_contains call to prevent non-string values from causing errors in email placeholder replacement logic within clean_before_send method.
Usage Tracking
stripe/views/lists/coupons-upsell.php
Inserted tracking call to record upsell coupons tab view event via FrmUsageController::update_flows_data() after image folder URL configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A guard clause hops through the email hay,
While tracking calls now log the day,
Small fixes bloom where bugs once lay—
Type-safe and tracked, we hop our way! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Track viewing the Coupons tab' directly aligns with the main objective of adding tracking for Coupons tab views, which is the primary change evidenced by the new tracking call in coupons-upsell.php.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coupons-tab-usage-tracking

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io
Copy link
Copy Markdown

deepsource-io bot commented Feb 11, 2026

Here's the code health analysis summary for commits eaec45f..aa895a6. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource PHP LogoPHP❌ Failure
❗ 1 occurence introduced
View Check ↗
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@truongwp truongwp requested a review from Crabcyborg February 11, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant