Skip to content

🐛 Mobile | Re-enable Firebase Analytics on iOS#1554

Open
jernejk wants to merge 1 commit into
mainfrom
fix/ios-firebase-analytics
Open

🐛 Mobile | Re-enable Firebase Analytics on iOS#1554
jernejk wants to merge 1 commit into
mainfrom
fix/ios-firebase-analytics

Conversation

@jernejk

@jernejk jernejk commented Apr 23, 2026

Copy link
Copy Markdown
Member
  1. What triggered this change? (PBI link, Email Subject, conversation + reason, etc)

✏️ Today's production pulse report showed that iOS users are invisible to Firebase Analytics / GA4 — every LogEvent() call from iOS has been a silent no-op since PR #1212 (Mar 2025). The iOS branch of RegisterFirebase() never initialised analytics, and the prod GoogleService-Info.plist ships with IS_ANALYTICS_ENABLED=false. Android has been fine throughout.

Pulse report: https://ssw-rewards-prod-today-report-20260423.surge.sh

Verified empirically:

  • firebase apps:sdkconfig IOS ... --project ssw-rewards-52a58IS_ANALYTICS_ENABLED=false
  • src/MobileUI/MauiProgram.cs (current main) only calls FirebaseAnalyticsImplementation.Initialize(activity) under #elif ANDROID. The #if IOS block has no analytics init.
  • No programmatic overrides anywhere in the codebase (no SetAnalyticsCollectionEnabled, no FIREBASE_ANALYTICS_COLLECTION_ENABLED in Info.plist).
  1. What was changed?

✏️ Single-file change in src/MobileUI/MauiProgram.cs:

  • Moved using Plugin.Firebase.Analytics; out of the #elif ANDROID block so iOS can use it too.
  • Added one line inside the iOS WillFinishLaunching lifecycle event:
    // Override IS_ANALYTICS_ENABLED=false that ships in the prod plist.
    CrossFirebaseAnalytics.Current.IsAnalyticsCollectionEnabled = true;

That property setter delegates to FirebaseAnalytics.SetAnalyticsCollectionEnabled(true) under the hood (confirmed from Plugin.Firebase iOS source), which takes precedence over the plist flag at runtime. No need to regenerate the production GoogleService-Info.plist — though it would still be good hygiene to do so separately so the plist reflects intent.

Android is untouched — it already works via FirebaseAnalyticsImplementation.Initialize(activity) + manifest flag.

Validation plan

  • TestFlight build, open the app on iOS, trigger quiz_start + reward_view
  • Confirm events appear in Firebase Console → Analytics → DebugView (or Realtime) within ~1 minute
  • Confirm Android still flows events as before
  • (Follow-up, not this PR) regenerate prod iOS GoogleService-Info.plist from Firebase Console with analytics enabled, update the GitHub secret that release workflows inject from
  1. Did you do pair or mob programming?

✏️ Paired with Claude Opus 4.7 (1M context) — investigation (git archaeology on PR #1212), Plugin.Firebase source reading, and the fix itself.

The iOS branch of RegisterFirebase() never initialised analytics and
the prod GoogleService-Info.plist ships with IS_ANALYTICS_ENABLED=false,
so every LogEvent() call from iOS has been a silent no-op since
PR #1212 (Mar 2025). Android is unaffected.

Force-enable collection at runtime via Plugin.Firebase.Analytics so
iOS sends quiz/reward/screen events to GA4 regardless of the plist
flag. Matches the intent already expressed by the Android branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 23, 2026 10:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Re-enables Firebase Analytics event collection on iOS by explicitly enabling analytics at runtime during app startup, addressing the current “silent no-op” behavior caused by an iOS plist flag and missing iOS-side enablement.

Changes:

  • Makes Plugin.Firebase.Analytics available for iOS by moving the using directive out of the Android-only preprocessor block.
  • Enables Firebase Analytics collection on iOS during WillFinishLaunching via CrossFirebaseAnalytics.Current.IsAnalyticsCollectionEnabled = true;.

@0xharkirat 0xharkirat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I am curious, will this be shipped immediately?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants