plausible-tracker
plausible-tracker copied to clipboard
feat: add an enabled flag to options
Description
This adds an enabled bool option that would disable sending any events to Plausible, but keep all functions working.
Related Issue
Fixes https://github.com/plausible/plausible-tracker/issues/9
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [X] My code follows the code style of this project.
- [X] My change requires a change to the documentation.
- [X] I have updated the documentation accordingly.
- [X] I have read the CONTRIBUTING document.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
Codecov Report
:exclamation: No coverage uploaded for pull request base (
master@a5f8e94). Click here to learn what that means. The diff coverage isn/a.
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
Coverage ? 100.00%
==========================================
Files ? 2
Lines ? 68
Branches ? 18
==========================================
Hits ? 68
Misses ? 0
Partials ? 0
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update a5f8e94...b4d9f8b. Read the comment docs.
Sorry I didn't have notifications on for this repository...
LGTM. @Maronato do you have any comments?
This would be quite useful if someone uses trackEvent() or trackPageview() functions throughout their codebase and wants to disable Plausible analytics for development, staging, or testing environments, without having to wrap the functions to ensure they're always available.