1

So I'm having issues logging event parameters from my application to the Firebase console. The events and their parameters show up as expected on Firebase's DebugView, and when I click on the events on the Events tab, the events all show up. However, there is no data available for the parameters I logged, even though they are default Firebase params.

I've done a decent amount of reading into Firebase's somewhat confusing documentation, and see that in order to see custom parameters show up on the dashboard, I need to register them within the application (even though there are some hard limits on the number of textual parameters we're allowed). However, I didn't read anything about such limits being imposed on Firebase's default events and default parameters, or that we would even need to register default parameters.

I've abstracted Firebase's logEvent functionality into the following logic (included a getter because I'm using Firebase throughout multiple pods):

func sendEvent(eventType: String, toolName: String, toolAction: String, /*actionLabel: String,*/ actionDetail: String?) {
        switch provider {
        case .firebase:
            if actionDetail != nil {
                Analytics.logEvent(eventType, parameters: [
                    AnalyticsParameterOrigin: toolName,
                    AnalyticsParameterMethod: toolAction,
                    AnalyticsParameterContent: actionDetail
                    ])
            } else {
                Analytics.logEvent(eventType, parameters: [
                    AnalyticsParameterOrigin: toolName,
                    AnalyticsParameterMethod: toolAction
                    ])
            }

        case .GA:

            print("Event received w/deprecated GA")
        }
    }

func getAnalyticsEventType(eventString: String) -> String {
        switch eventString {
        case "selectContent" : return AnalyticsEventSelectContent
        case "viewItem" : return AnalyticsEventViewItem
        default: return ""
        }
    }

And call my custom method as follows:

ValuesExploration.analytics?.sendEvent(eventType: ValuesExploration.analytics?.getAnalyticsEventType(eventString: "selectContent") ?? "", toolName: "Values", toolAction: "Happiness Sticker Selected", actionDetail: value.name)

Upon calling the method, it logs the default event to the dashboard, but none of the default parameters. Any input as to why this is happening would be greatly appreciated, thank you in advance!

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Geri
  • 21
  • 3

1 Answers1

0

Events types have specific parameters that they allow.

Parameters for AnalyticsEventSelectContent[1] are:

  • AnalyticsParameterContentType

  • AnalyticsParameterItemID

While for AnalyticsEventViewItem [2] are:

  • AnalyticsParameterItemID
  • AnalyticsParameterItemName
  • AnalyticsParameterItemCategory
  • AnalyticsParameterItemLocationID (optional)
  • AnalyticsParameterPrice (optional)
  • AnalyticsParameterQuantity (optional)
  • AnalyticsParameterCurrency (optional)
  • AnalyticsParameterValue (optional)
  • AnalyticsParameterStartDate (optional)
  • AnalyticsParameterEndDate (optional)
  • AnalyticsParameterFlightNumber (optional)
  • AnalyticsParameterNumberOfPassengers (optional)
  • AnalyticsParameterNumberOfNights (optional)
  • AnalyticsParameterNumberOfRooms (optional)
  • AnalyticsParameterOrigin (optional)
  • AnalyticsParameterDestination (optional)
  • AnalyticsParameterSearchTerm (optional)
  • AnalyticsParameterTravelClass (optional)
Oluwafemi Sule
  • 36,144
  • 1
  • 56
  • 81
  • So you're saying that if I want these events to show their parameters in the dashboard, that those are the parameters I have to log them with? Will I still have to register them? – Geri May 20 '19 at 21:45
  • No, [only custom parameter per event needs to be registered](https://support.google.com/firebase/answer/7397304?hl=en&ref_topic=6317489). You can register the ones used in your question per event type or choose a fitting event type for your analytics data from the suggested ones – Oluwafemi Sule May 21 '19 at 05:44
  • I'm having a difficult time understanding. Only custom parameters need to be registered, but I still need to register the ones used in my question even though they are default Firebase parameters? Sorry if I'm just asking the same question over and over again, I'm just still a bit confused. – Geri May 21 '19 at 14:01
  • The ones used in your question are specific events that they are for. Look at it this way, an event has its parameters. Where you're a parameter is used other than that documented for the event, it is a custom one and should be registered. That an event parameter is defined for one event doesn't make it useful for an entirely different event. Does this make sense? – Oluwafemi Sule May 21 '19 at 15:50
  • Oh I see, so each event has its own set of default params that can be logged without having to register them as custom? I thought default parameters were uniform across Firebase but it sounds like each event has their own distinct sets of default parameters that don't need to be registered. Is that correct? – Geri May 21 '19 at 17:02
  • Thank you! However, I am now faced with an interesting problem. To test logging a default event with its default parameter, I logged `Analytics.logEvent(AnalyticsEventUnlockAchievement, parameters: [AnalyticsParameterAchievementID: "app_launch_test"])` in my application's AppDelegate and am still facing the same problem. The Event with its parameter shows up in the DebugView, but only the event (without its parameter) shows up on the dashboard. Any idea as to why that may be the case? Thanks so much for your help btw I really appreciate it :) – Geri May 22 '19 at 19:40
  • Hi Oluwafemi sule and Geri, i have logged some predefined parameters. in dashboard, some predefined parameter is only showing. any idea about this. https://stackoverflow.com/questions/57660104/android-firebase-analytics-predefined-and-custom-parameters-not-working/57696929 – Venka Tesh user5397700 Sep 09 '19 at 11:59