Skip to content

Track viewing the Coupons tab#2950

Merged
Crabcyborg merged 4 commits into
masterfrom
coupons-tab-usage-tracking
Jun 19, 2026
Merged

Track viewing the Coupons tab#2950
Crabcyborg merged 4 commits into
masterfrom
coupons-tab-usage-tracking

Conversation

@truongwp

@truongwp truongwp commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved email placeholder detection by safely handling non-text values, preventing errors during data processing.
  • Chores

    • Added analytics tracking when viewing the coupons upsell tab, to better measure engagement and feature adoption.

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3bdfca83-000e-45ad-9ea2-fb89b2d18000

📥 Commits

Reviewing files that changed from the base of the PR and between aa895a6 and e1c31bb.

📒 Files selected for processing (1)
  • classes/models/FrmUsage.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/models/FrmUsage.php

📝 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

Safety and Tracking Improvements

Layer / 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 | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Track viewing the Coupons tab' directly aligns with the main change: adding a tracking call to log Coupons tab views in usage data.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 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

deepsource-io Bot commented Feb 11, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 2ebfe3a...e1c31bb on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Jun 19, 2026 2:31p.m. Review ↗
JavaScript Jun 19, 2026 2:31p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@truongwp
truongwp requested a review from Crabcyborg February 11, 2026 16:59

@Crabcyborg Crabcyborg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @truongwp!

🚀

@Crabcyborg Crabcyborg added this to the 6.32.1 milestone Jun 19, 2026
@Crabcyborg
Crabcyborg merged commit aa290c4 into master Jun 19, 2026
34 checks passed
@Crabcyborg
Crabcyborg deleted the coupons-tab-usage-tracking branch June 19, 2026 14:57
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.

2 participants