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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With