Firebase analytics displays incorrect data in DebugView

拟墨画扇 提交于 2019-12-23 09:57:05

问题


I'm using Firebase Analytics. I registered two user properties and I have two custom events, each events includes 3 to 50 different options options. I met the problem that when I set the user property, very often DebugView displays the old user property for the event or is not displayed at all. Sometimes it works correctly. Please tell me how it can be fixed?

My code.

final class FirebaseAnalyticsManager {

    enum ScreenType {
        case editStoryScreen, homeScreen, previewStoryScreen, storeItemPreviewScreen

        var name: String {
            switch self {
            case .editStoryScreen:
                return "Edit Story Screen"
            case .homeScreen:
                return "Home Screen"
            case .previewStoryScreen:
                return "Preview Story Screen"
            case .storeItemPreviewScreen:
                return "Store Item Preview Screen"
            }
        }
    }

    enum Event {
        case templateSelected, mediaExport

        var name: String {
            switch self {
            case .templateSelected:
                return "TemplateSelected"
            case .mediaExport:
                return "MediaExport"
            }
        }
    }

    enum MediaExportDestination {
        case story, page, pageToInstagram

        var name: String {
            switch self {
            case .story:
                return "Story"
            case .page:
                return "Page"
            case .pageToInstagram:
                return "PageToInstagram"
            }
        }
    }

    private enum Keys: String {
        case exportType, templateName
    }

    private init() { }
    static let shared = FirebaseAnalyticsManager()

    open func trackScreen(_ screenType: ScreenType, screenClass: String?) {
        Analytics.setScreenName(screenType.name, screenClass: screenClass)
    }

    private func trackEvent(_ event: Event, parameters: [String : NSObject]?) {
        Analytics.logEvent(event.name, parameters: parameters)
    }

    open func trackTemplateSelected(_ templateName: String) {
        let key = Keys.templateName.rawValue
        Analytics.setUserProperty(templateName, forName: key)
        var parameters = [String : NSObject]()
        parameters[key] = templateName as NSObject
        trackEvent(.templateSelected, parameters: parameters)
    }

    open func trackMediaExport(_ destination: MediaExportDestination) {
        let key = Keys.exportType.rawValue
        Analytics.setUserProperty(destination.name, forName: key)
        var parameters = [String : NSObject]()
        parameters[key] = destination.name as NSObject
        trackEvent(.mediaExport, parameters: parameters)
    }

}

In this event, all data is correct.

In this event, the data is incorrect, since it should be Template5 in userProperties.


回答1:


Firebase team answered to me

Hi there, I just got an update from our engineers confirming that it is indeed a bug in our end. They are already working on a fix for this issue, but I can’t share details or timeline as to when this will be fixed. Please keep tabs on our release notes for any updates regarding this.



来源:https://stackoverflow.com/questions/50464938/firebase-analytics-displays-incorrect-data-in-debugview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!