3

Currently we're using Firebase in our iOS app.

I'm curious wether it is possible (and valid) to disable automatic reporting (using FirebaseScreenReportingEnable) and to call Analytics.logEvent (with the required params) manually.

Something in the lines of

Analytics.logEvent("screen_view", parameters: [
  "firebase_event_origin": "auto",
  "firebase_previous_class": "PrevClass",
  "firebase_previous_id": "1",
  "firebase_previous_screen": "PrevScreen",
  "firebase_screen": "NewScreen",
  "firebase_screen_class": "NewClass",
  "firebase_screen_id": "2",
])
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
dunyakirkali
  • 369
  • 5
  • 16

2 Answers2

3

You can track screens by explicit calls by calling setScreenName():

Analytics.setScreenName(screenName, screenClass: screenClass)
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    But this does not achieve "disable automatic reporting " and also sends screen data which is automatically set by Firebase. – Emre Önder Apr 29 '19 at 13:40
  • There were two questions: 1) how to explicitly track screen views, 2) how to disable implicit reporting. Since you already answered #2, I provided the correct answer (and a reference to the docs) for #1. – Frank van Puffelen Apr 29 '19 at 14:02
-1

You can't manually trigger screen_view event. However, you can disable automatic screen recording via adding below key to your targets plist;

<key>FirebaseScreenReportingEnabled</key>
<false/>

and send a Manuel report to Firebase with custom event name;

 func sendScreenDataToGA(screenName: String) {
    Analytics.logEvent("screen_tracking_view", parameters: [
        "screen_name": screenName
    ])
}
Emre Önder
  • 2,408
  • 2
  • 23
  • 73