简体   繁体   中英

Logging custom events in the Firebase Analytics console (Swift)

I'm trying to log custom events for my location rating app (Swift). After looking through examples it looks like you give attributes a value similar to a JSON database. I still haven't seen the event named logged in the analytics console (it's been about a week).It doesn't have any debug errors. Here is the instance:

FIRAnalytics.logEventWithName("Ratings", Parameters[
    "rating": (indexPath.row + 1)

Any advice?

The syntax for logging a custom event in Swift would be:

FIRAnalytics.logEventWithName("Ratings", parameters: [
  "rating": (indexPath.row + 1)
])

Make sure that part of your code is getting executed by setting a break-point. Perhaps it's not being run.

Its really late but it may help someone

 Analytics.logEvent("Ratings", parameters: [
        "rating" : (indexPath.row + 1)
        ])

FIRAnalytics is replaced with Analytics and logEventWithName is replaced with logEvent

import FirebaseAnalytics

Example code:

Analytics.logEvent("share_image", parameters: [
  "name": name as NSObject,
  "full_text": text as NSObject,
])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM