I am following the setup https://www.raywenderlich.com/18579842-firebase-analytics-getting-started
I am using flag -FIRAnalyticsDebugEnabled
I view the real-time result in Firebase Analytics Debug View
I also check the console output of XCode.
However, I notice that, if I write my code in the following way
Not receiving any Firebase analytics event
import Firebase
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
But, if I write the code in the following way
Receiving Firebase analytics first_open event
import Firebase
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
let title = "xxx"
Analytics.logEvent(AnalyticsEventSelectContent, parameters: [
AnalyticsParameterItemID: "id-(title)",
AnalyticsParameterItemName: title,
AnalyticsParameterContentType: "cont",
])
return true
}
I need to logEvent a dummy event explicitly, in order to receive first_open
.
May I know why is it so? Is there a way, I can still receive first_open
event automatically, without having to log a dummy event?
2
Answers
This is the code snippet I am using, to ensure
first_open
event is sent to Firebase console.I have verified by looking at Firebase console. The
first_open
event is received.Still, I am not sure why such extra code snippet is required. I thought it should be sent automatically?
In my app I have admob ads and analytics. My assumption is that because of admob sdk, analytics stops working. This is certainly a bug.
Solution:
You will have to request iOS ATT alert or UMP consent from Google.
I prefer UMP sdk because it solves ATT alert and GDPR.
UMP sdk: https://developers.google.com/admob/ump/ios/quick-start
How it works: https://support.google.com/admob/answer/10115027