trackFirstOpenAfterConsent method
Tracks the first app open, once the user has given tracking consent.
Deliberately not called by init: on a brand new install init runs before the onboarding consent tap, and we do not track before consent. Called from the onboarding welcome page, right after consent is stored.
Implementation
Future<void> trackFirstOpenAfterConsent() async {
if (_sharedPreferences.getBool(_TAG_FIRST_OPEN_TRACKED) == true) {
return;
}
// `setBool` writes the in-memory cache before it awaits the platform, so
// the undebounced consent button cannot get two events out of a double tap.
await _sharedPreferences.setBool(_TAG_FIRST_OPEN_TRACKED, true);
AnalyticsHelper.trackEvent(AnalyticsEvent.appFirstOpen);
}