Analytics privacy: keep PII and financials off PostHog#8
Conversation
- identify() sends the opaque Clerk id only (no email/name) - subscription_* events drop name/price/currency; add a coarse price_bucket (under_5/5_15/15_50/50_plus) for non-sensitive spend signal - add a "Share anonymous analytics" opt-out in Settings, persisted and applied on launch (posthog.optIn/optOut) - tests for priceBucket Subscription data and PII stay on-device / in Clerk; PostHog holds only behavior keyed to the anonymous id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAnalytics tracking now supports persisted opt-out preferences, opaque user identification, and coarse price buckets. Subscription event payloads no longer include names or exact pricing, and settings expose a control for anonymous analytics sharing. ChangesAnalytics privacy and event tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Settings
participant KeyValueStorage
participant PostHog
User->>Settings: toggle anonymous analytics
Settings->>KeyValueStorage: persist analytics_optout
Settings->>PostHog: call optIn or optOut
PostHog->>PostHog: apply collection preference
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/_layout.tsx`:
- Around line 22-26: Update the launch effect around getKv and posthog.optOut()
to add an else branch that calls posthog.optIn() whenever ANALYTICS_OPTOUT_KEY
is not "1", keeping PostHog’s persisted state synchronized with the KV
preference.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8fd7449a-d80d-4e1c-b119-040fd361e66c
📒 Files selected for processing (6)
__tests__/analytics.test.tsapp/(tabs)/index.tsxapp/(tabs)/settings.tsxapp/_layout.tsxapp/subscriptions/[id].tsxlib/analytics.ts
Subscription data and PII stay on-device / in Clerk; PostHog holds only behavior keyed to the anonymous id.