-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/add frontend tracking filter #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add `admin_session_recording_should_load_frontend` filter to enable complex programmatic logic for frontend tracking (runs after UI paths). Useful for conditions based on query params, user meta, or other dynamic factors that can't be configured via the settings UI.
WalkthroughAdded CHANGELOG.md documentation with version 0.1.1 release notes. Updated admin-session-recording.php to version 0.1.1, introducing a new Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as WordPress Admin
participant Plugin as Frontend Tracking Check
participant Filter as New Filter Hook
participant Scripts as Tracking Scripts
Admin->>Plugin: Trigger page load (admin area)
Plugin->>Plugin: Check UI-configured paths
alt Path matches
Plugin->>Filter: Call admin_session_recording_should_load_frontend filter
Filter-->>Plugin: Return boolean (allow/deny)
alt Filter returns true
Plugin->>Scripts: Emit tracking scripts
Scripts-->>Admin: Load frontend tracking
else Filter returns false
Plugin->>Admin: Skip tracking
end
else Path doesn't match
Plugin->>Admin: Skip tracking
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
admin-session-recording.php (1)
317-343: Excellent filter implementation with comprehensive documentation.The new
admin_session_recording_should_load_frontendfilter is well-designed and positioned correctly after UI-configured path checks. The inline documentation is thorough, providing clear examples of use cases. The logic flow is efficient, only invoking the filter when UI paths don't match, and the default value offalseis appropriately safe.One optional consideration: the
$optionsparameter contains API keys (hotjar_id,clarity_id). While this follows common WordPress patterns and provides useful context for filter callbacks, you may want to add a note in the documentation reminding developers not to log or expose these values inadvertently.If you'd like to add the security note, consider this addition to the docblock:
* @param bool $should_load Whether to load tracking scripts for this path (default: false). * @param string $current_path The current URL path. * @param array $options The plugin options. + * Note: Contains sensitive data (API keys); avoid logging or exposing. * * @return bool True to load tracking scripts, false otherwise.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
CHANGELOG.md(1 hunks)admin-session-recording.php(3 hunks)
🔇 Additional comments (2)
CHANGELOG.md (1)
1-15: LGTM! Well-documented changelog.The changelog follows standard formatting conventions and accurately documents both the new 0.1.1 release with the filter addition and the previous 0.1.0 release features. The description clearly explains the purpose and timing of the new filter hook.
admin-session-recording.php (1)
6-6: LGTM! Version bumps are consistent.The version has been correctly updated to 0.1.1 in both the plugin header and the constant definition, matching the CHANGELOG entry.
Also applies to: 23-23
Summary by CodeRabbit
Release Notes
New Features
Chores