Skip to content

Firebase Analytics Not Working on iOS (Works on Android)Β #8918

@manansethi22

Description

@manansethi22

Description

Firebase Analytics events are successfully tracked and visible in the Firebase Console when running on Android, but completely fail to register on iOS. No errors are thrown on iOSβ€”analytics calls execute silently without logging any data to Firebase.

Environment

  • Expo SDK: 53.0.16
  • @react-native-firebase/analytics: 21.7.1
  • @react-native-firebase/app: 21.14.0
  • React Navigation: 6.1.17
  • React Native Version: (Expo managed)
  • Platform: iOS (Android works fine)
  • Build Configuration: Expo managed workflow with expo-build-properties and useFrameworks: "static"
  • Testing Device/Simulator: Physical iOS device and iOS Simulator (multiple versions tested)

Current Implementation

Analytics Integration

import analytics from "@react-native-firebase/analytics";

// Screen tracking in AppNavigator.js
onStateChange={async () => {
const previousRouteName = routeNameRef.current;
const currentRouteName = navigationRef.current.getCurrentRoute().name;
const currentRoute = navigationRef.current.getCurrentRoute();

if (previousRouteName !== currentRouteName) {
await analytics().logScreenView({
screen_name: currentRouteName,
screen_class: currentRouteName,
previous_screen: previousRouteName || "None",
...currentRoute.params,
});

await analytics().logEvent("screen_change", {
  previous_screen: previousRouteName || "None",
  current_screen: currentRouteName,
  timestamp: new Date().toISOString(),
});

}
}

// Custom event tracking in components
await analytics().logEvent("phone_contact", {
button_type: "phone",
phone_number: "18884413856",
});

App Configuration (app.config.js)

ios: {
supportsTablet: true,
bundleIdentifier: "com.bandana.prod",
googleServicesFile: process.env.GOOGLE_SERVICES_PLIST,
buildNumber: "14",
usesAppleSignIn: true,
infoPlist: {
UIBackgroundModes: ["fetch"],
// ... other settings
},
},
plugins: [
[
"expo-build-properties",
{
ios: {
useFrameworks: "static",
useModularHeaders: true,
newArchEnabled: true,
},
android: {
newArchEnabled: true,
hermesEnabled: true
},
},
],
"@react-native-google-signin/google-signin",
"@react-native-firebase/app",
"expo-apple-authentication"
]

Dependencies (package.json)

{
"dependencies": {
"@react-native-firebase/analytics": "^21.7.1",
"@react-native-firebase/app": "^21.14.0",
"@react-native-firebase/auth": "^21.14.0",
"expo": "^53.0.16",
"firebase": "^12.1.0",
"@react-navigation/native": "^6.1.17",
"@react-navigation/stack": "^6.3.29"
}
}

Firebase Initialization

Firebase JavaScript SDK (firebase v12.1.0) is initialized separately for authentication, but native @react-native-firebase/analytics module is used for analytics tracking.

Steps to Reproduce

  1. Build iOS app using EAS Build with the configuration shown above
  2. Install app on physical iOS device or iOS simulator
  3. Navigate through multiple screens (triggers logScreenView and logEvent calls)
  4. Perform actions that trigger custom analytics events (e.g., phone contact button)
  5. Wait 24-48 hours for Firebase Analytics data processing
  6. Check Firebase Console Analytics Dashboard
  7. Compare with Android build results

Expected Behavior

  • Analytics events should appear in Firebase Console for iOS builds
  • logScreenView() should track screen navigation events
  • logEvent() should track custom events
  • iOS behavior should match Android behavior

Actual Behavior

  • βœ… Android: All analytics events (logScreenView, logEvent) appear in Firebase Console as expected
  • ❌ iOS: Zero analytics events are recorded in Firebase Console
  • ❌ iOS: No errors thrown in console, Xcode logs, or Metro bundler
  • ❌ iOS: Firebase initialization completes successfully ("Firebase app initialized" logged)
  • ❌ iOS: Analytics function calls execute without throwing errors but produce no data
  • ❌ iOS: Even after 48+ hours, no analytics data appears for iOS

Debugging Steps Already Attempted

I've exhausted multiple solutions from GitHub issues and documentation:

  • βœ… Verified GoogleService-Info.plist is present and correctly configured in the build
  • βœ… Confirmed GOOGLE_SERVICES_PLIST environment variable is set and pointing to valid plist file
  • βœ… Verified Firebase project ID matches across Android/iOS configurations
  • βœ… Checked that Analytics is enabled in Firebase Console for the project
  • βœ… Confirmed iOS app is properly registered in Firebase Console with correct bundle ID (com.bandana.prod)
  • βœ… Tested on multiple iOS versions and physical devices/simulators
  • βœ… Waited 24-48 hours for data processing (Android data appears within hours)
  • βœ… Verified analytics collection is NOT disabled in code or Firebase Console settings
  • βœ… Checked Info.plist includes all required Firebase keys from GoogleService-Info.plist
  • βœ… Confirmed native Firebase pods are being installed (checked Podfile.lock)
  • βœ… Ran npx expo prebuild --clean and rebuilt from scratch
  • βœ… Verified no proxy/firewall blocking Firebase endpoints during testing
  • βœ… Checked Xcode console logs for any Firebase-related warnings (none found)

Suspected Root Causes

Given the Expo + React Native Firebase + New Architecture setup, potential issues could be:

  1. Static Frameworks Configuration Conflict: The useFrameworks: "static" setting combined with newArchEnabled: true might cause pod linking issues with Firebase Analytics native module specifically on iOS.

  2. Missing Analytics Plugin Configuration: The @react-native-firebase/analytics package is installed but not explicitly declared as a plugin in app.config.js. While only @react-native-firebase/app is listed, Analytics may require explicit plugin registration in Expo 53+.

  3. App Tracking Transparency (ATT) Requirements: iOS 14+ requires explicit permission for tracking. Firebase Analytics might be silently failing due to missing NSUserTrackingUsageDescription in Info.plist or IDFA collection being blocked without proper ATT prompt.

  4. Expo Auto-linking Issue: There may be an incompatibility with how Expo auto-links @react-native-firebase/analytics native modules when useFrameworks: "static" is enabled.

  5. New Architecture Compatibility: With newArchEnabled: true and Hermes enabled, there may be a compatibility issue with @react-native-firebase/analytics v21.7.1 on iOS specifically under the new architecture.

  6. Missing Native Initialization: Unlike Android, iOS might require explicit native-side initialization code in AppDelegate that Expo's auto-configuration doesn't handle for Analytics.

Questions

  1. Is there a known issue with @react-native-firebase/analytics v21.7.1 + Expo SDK 53 + New Architecture on iOS?
  2. Should @react-native-firebase/analytics be explicitly added to the plugins array in app.config.js, or is @react-native-firebase/app sufficient for Expo?

Additional Context

This is blocking production analytics tracking for all iOS users. The fact that Android works perfectly with the exact same JavaScript code suggests the issue is isolated to iOS-specific native integration rather than JavaScript implementation. Any guidance on debugging or resolving this would be greatly appreciated.

Workarounds Attempted

  • Tried initializing analytics explicitly: await analytics().setAnalyticsCollectionEnabled(true); - No effect
  • Attempted downgrading to @react-native-firebase/analytics v20.x - Build failed with pod conflicts
  • Tried removing newArchEnabled: true temporarily - Still no analytics on iOS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions