firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Firebase Analytics on iOS Extensions is not working correctly

Open giorgia opened this issue 6 years ago • 26 comments

DAU are wrong on iMessage extension

On iOS extensions (iMessage and Keyboard) the numbers of Firebase DAU looks wrong. I've compared them with Fabric DAU and the discrepancy is 10x lower in Firebase vs Fabric. I know they are different product etc, but the strange part is that on the main app the numbers are almost exactly the same. Moreover, I've been checking some of the main app events that should trigger a user_engagement event. session_start (automatically fired by Firebase), compared to the number of users that triggered that event result to be 15x bigger than the DAU. While on the main app DAU and users triggering the session_start is the same number.

Environment:

  • Xcode version: iOS11+
  • Firebase SDK version: 5.20.2
  • Firebase Component: Analytics
  • Component version: 5.8.1

Steps to reproduce:

Observing the live stream you can noticed the the user_engagement is almost never fired on iMessage extension.

giorgia avatar Apr 25 '19 14:04 giorgia

Internally tracked at b/131333733

paulb777 avatar Apr 25 '19 19:04 paulb777

Hi @paulb777! Please feel free to reach me if you need any more informations. As Fabric will be gone soon, we are actively looking to find a solution for this issue. Thank you for your help!

giorgia avatar Apr 30 '19 13:04 giorgia

Hi @giorgia FirebaseAnalytics is not currently supported with iOS extensions. There are some details at https://firebase.google.com/docs/projects/multiprojects.

paulb777 avatar Apr 30 '19 14:04 paulb777

Hi @paulb777, thank you for your answer. Is there any plan to support them in the near future? If so will that be available before Fabric sunset? Thank you

giorgia avatar May 01 '19 14:05 giorgia

@giorgia It's an open question that we're working to resolve.

paulb777 avatar May 01 '19 14:05 paulb777

@paulb777 Any updates of this question? Since Google Analytics is sunsetting, we're also looking for a solution to replace the GA SDK

Thanks!

JohnnyTseng avatar Aug 04 '19 06:08 JohnnyTseng

Hi @paulb777 we recently noticed a spike in our extension data ~mid september - wondering if a fix was made for this issue that would cause the extensions to more consistently be tracked and therefore we would see a spike. CC @giorgia

JessicaGiphy avatar Oct 04 '19 16:10 JessicaGiphy

Allen, can you answer @JessicaGiphy's question?

morganchen12 avatar Oct 04 '19 17:10 morganchen12

@JessicaGiphy we have not made any changes concerning extensions on the SDK.

allenktv avatar Oct 04 '19 17:10 allenktv

Thanks for the quick response

JessicaGiphy avatar Oct 04 '19 20:10 JessicaGiphy

@paulb777 is it true that app extensions for iOS are still not supported for Firebase Analytics (and hence Crashlytics)? This seems like a BIG deal, as many, many apps have app extensions that need to be monitored for analytics and crashes.

inPhilly avatar Jan 04 '20 04:01 inPhilly

@inPhilly Firebase Analytics does not support iOS extensions.

Based on https://stackoverflow.com/questions/27146019/how-to-use-crashlytics-with-ios-os-x-today-view-extensions, it looks like Crashlytics does have extension support. Presumably Crashlytics will work with the exception of its features that depend on Analytics.

Please open a separate issue for Crashlytics and extensions if you'd like to follow up in more detail.

paulb777 avatar Jan 04 '20 15:01 paulb777

Crashlytics is what I cannot get verified for the app extension. Firebase picks up the plist file for the regular app first when running the app extension, throws an error because if this, and can’t see the file for the app extension. The app extension must be a separate app in firebase as it has a separate bundle id in Xcode; hence it has its own plist file with its own bundle id; but when running an app extension, for some reason, firebase picks up the regular app’s file and not the app extension’s file. I have pored over all of your documentation (months ago, gave up, came back again this weekend to give it another go in case you had fixed the errors - they have not been fixed) - and there is no way to do this listed anywhere. One project, two apps (one the regular app/appId and one the extension app/appId), and two plist files with the same name but different bundleIds and firebase app ids. Try it yourself and please point me to a working example anywhere on the web if I am wrong. Please - point me to some way to get my app extension verified in firebase for even Crashlytics alone.

On Jan 4, 2020, at 10:29 AM, Paul Beusterien [email protected] wrote:

 @inPhilly Firebase Analytics does not support iOS extensions.

Based on https://stackoverflow.com/questions/27146019/how-to-use-crashlytics-with-ios-os-x-today-view-extensions, it looks like Crashlytics does have extension support. Presumably Crashlytics will work with the exception of its features that depend on Analytics.

Please open a separate issue for Crashlytics and extensions if you'd like to follow up in more detail.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

inPhilly avatar Jan 04 '20 19:01 inPhilly

@inPhilly Understood. And sorry to hear about how challenging this is.

Please make an issue specific to Crashlytics so we can route a succinct issue to that team. This issue is about Analytics.

paulb777 avatar Jan 04 '20 19:01 paulb777

@paulb777 can analytics handle this job or not? in iOS extensions now

slatop avatar May 06 '20 04:05 slatop

@slatop As pointed out above, Firebase Analytics does not currently support iOS extensions.

paulb777 avatar May 06 '20 14:05 paulb777

@paulb777 Thank you. When can I use firebase in the extension. I have a keyboard extension project that needs analytics support after fabric fails. Very urgent. please . please. please

slatop avatar May 07 '20 03:05 slatop

@slatop Sorry, it's on the list of requested features but support isn't planned in the near future.

paulb777 avatar May 07 '20 14:05 paulb777

Any news on this? Its been a year and a half since it was reported...

Every good app nowadays has at least one extension, meaning broken analytics is a real deal breaker.

sisoje avatar Dec 04 '20 16:12 sisoje

Any update? How to add firebase Analytics to the ios App extensions?

AnkitaPundir avatar Feb 23 '21 11:02 AnkitaPundir

Please provide us tentative timelines on when firebase will start support for app extensions. We have been waiting for this for a long time.

wshrads avatar Jul 29 '21 15:07 wshrads

For anyone struggling with getting the debug view output to show up in an iOS extension, it helped to add this line under FirebaseApp.configure():

FirebaseConfiguration.shared.setLoggerLevel(.debug)

Essentially, my issue was the -FIRDebugEnabled argument being ignored by the extension, and the above line manually configured Firebase into debug mode after which logger outputs started to be shown.

ibayramli avatar Aug 08 '21 13:08 ibayramli

I could be running into other issues but as far as I can tell, setting the LogLevel does not enable DebugView within the Firebase Console. It'd be great to be able to programmatically enable/disable the debugView functionality. I'm running into similar issues with being unable to efficiently test metrics on iOS extensions.

lucianthorr avatar Oct 15 '21 16:10 lucianthorr

Did anyone manage to get it working or somehow see anything in events debug view in Firebase console? I'm trying to use Firebase Analytics from Notification Service extension but so far no success... I'm also not sure about the current state of development of this feature, some people claim that it's not supported at all, while I get the feeling some managed to work around that as @ibayramli2001

kolboch avatar Nov 15 '21 12:11 kolboch

Just to give some summary of my attempts on the issue:

  • separate apps in firebase project
  • separate and targeted only for Notification Service GoogleService-Info.plist files
  • making sure that Firebase is initiated on main thread, and firing analytic event after specified delay (just making sure it's after Analytics enabled log) After all I couldn't manage to see the log for reporting event from analytics (my log before that is visible), nor is the event present in the debug view in Firebase console. So seems that extensions are not supported after all. I tried because in one of the issues someone claimed to have it working, maybe it's possible for keyboard extension (still just my guess what other person claim to have working), but for notification service extension no luck. We have one more reporting tool - Amplitude, and fortunately this one works, something to keep in mind when designing your app and choosing appropriate tools, for firebase we have to go with solution that would basically keep information about background notifications displayed in some storage and on app start we will report missing events just to be consistent.

kolboch avatar Nov 16 '21 14:11 kolboch

A year later. This is a huge pitfall of Firebase. I understand extensions are short-lived, but there are ways to get around it. I'm playing with the idea of an app group to transfer data from extension to target app, but the API like Analytics.logEvent don't allow me to alert the timestamp from what I can tell. So I'm having to tell my PO we either live with horribly wrong analytics data, or none at all (if we use Firebase).

SwiftNativeDeveloper avatar Nov 21 '22 15:11 SwiftNativeDeveloper