Conversation
- Remove research_mode feature-flag gate so events capture for all users; drop the now-unused flag and isAnalyticsEnabled getter - Add forecast events (forecast_viewed, forecast_scope_changed) - Add share funnel events (share_sheet_opened with source, share_tab_selected, share_completed gated on ShareResult success) - Add Clean Air Forum filter funnel events (tab opened, selfie source/capture, filter shared, wall consent and submission sent/failed) - Return ShareResult from AirQualityShareService so only real shares count - Enable lifecycle event capture and switch personProfiles to identifiedOnly - Add PosthogObserver for automatic $screen tracking and name all MaterialPageRoute push sites via RouteSettings - Register is_guest super property on guest entry/login; reset identity on session expiry fallback to guest - Delete unused manual session tracking (SDK manages sessions)
- Split AnalyticsService: core transport (capture/identity/super props) stays in analytics_service.dart; typed event wrappers move to per-domain extension files under services/analytics/, re-exported so call sites are unchanged - Inject AnalyticsService into AuthBloc and SurveyBloc (defaulting to the singleton) so bloc tests can mock analytics, matching the repository injection convention - Fold share-tab label and analytics name into the _ShareTab enhanced enum, restoring the single-entry-per-tab promise
PosthogObserver fires Posthog().screen on navigation; in tests the channel throws MissingPluginException, which the SDK only guards as PlatformException, failing the app-boot test.
…hygiene - resetUser() now re-registers is_guest=true after clearing identity, making guest fallback an invariant of every identity reset (logout, expiry) - Runtime SessionExpired handler resets analytics identity like the app-start expiry path already did - Failure events report the exception type instead of raw e.toString() so API response details are not sent to PostHog (CAF wall + survey submission)
… paths Sweep for the same class of issue as the review findings: account deletion, the app-start error fallback, and the session-expiry cleanup-failure path all emitted GuestUser without resetUser(), leaving events attributed to the prior identity. Account deletion was the worst case - a deleted user's device kept reporting under their identity. resetUser() is safe in catch blocks since it never throws.
Mobile posthog analytics
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.