Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Analytics - Can not logging only custom events

Tags:

We're trying to use firebase analytics in our ios app.

Default events seems to be logged with no problem.

5.1.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs)

However, only custom event is not logged with this log below.

5.1.0 - [Firebase/Analytics][I-ACS025018] Event not logged. Call +[FIRApp configure]: custom_event_name

I think configurating is following the document. We have two different project's plist for each targets to setting up development environment to use different Firebase projects based on build type or target.

guard let path = Bundle.main.path(forResource: googleServiceInfoPlist, ofType: "plist"),
  let opts = FirebaseOptions(contentsOfFile: path) else {
  fatalError("Couldn't load config file")
}
FirebaseApp.configure(options: opts)

I guessed multiple plists causes this problem at first, but there was no changes with a GoogleService-Info.plist and calling FirebaseApp.configure() .

Sending event's func is just like this.

private func sendToFirebase(_ event: Trackable) {
 Analytics.logEvent(event.name, parameters: event.properties)
}

What are the possible causes?

Thank you.

like image 348
fxwx23 Avatar asked Jul 06 '18 06:07

fxwx23


People also ask

How many conversion events can you have in firebase?

You can enable up to 30 events per project as conversions, in addition to the five that Analytics defines by default. Attribution information associated with an event is collected from the time of enablement forward.

Does firebase Analytics work offline?

Persistence BehaviorBy enabling persistence, any data that the Firebase Realtime Database client would sync while online persists to disk and is available offline, even when the user or operating system restarts the app. This means your app works as it would online by using the local data stored in the cache.


1 Answers

I solved by myself.

This is caused by setting up cocoapods for embedded framework.

My Podfile was like below,

platform :ios, '11.0'
swift_version = '4.1'
use_frameworks!

target 'AppCore' do
  pod 'Firebase/Core'

  target 'App' do
    inherit! :search_paths
  end
end

AppCore is embedded framework.

pod 'Firebase/xxx' should be targeted to main app, not embedded framework.

I did:

  • Eliminate dependency of Firebase from embedded framework
  • Fixed podfile not targeting to embedded framework

then tracked customs events correctly.

like image 95
fxwx23 Avatar answered Oct 11 '22 15:10

fxwx23