Firebase Analytics Quick Tip: The 'value' Parameter

Firebase Analytics provides a lot of nice reports for you out of the box — things like retention, active users, and some demographic information about the people using your app. And for specific events, you can see useful stats like the number of events fired over time or the average number of events per session. But one thing that you currently can’t do (outside of BigQuery) is see values associated with any custom parameters that you send down in a Firebase Analytics event.

While the team is looking into ways they can make this experience better, there is one feature you can use right now to get some of the answers you’re looking for. Every event you record in Firebase Analytics can accept a “value” parameter — this can be a floating point number or integer — and Firebase Analytics will give you back the average of this value over time.

For instance, let’s say your fitness app is recording an end-of-workout event that looks a little like this[1]:

FIRAnalytics.logEvent(withName: "workout_complete", parameters: [
  "time": 1804
  "exercise_type": "interval"
  "intensity": 2
])

Within the Firebase Analytics reports, you’ll be able to see the total number of workouts completed over time, the average number of workouts completed in a session, and the general age and gender breakdown of people completing workouts. But you can’t, for instance, track the average amount of time people spent working out.

On the other hand, if you were to provide that same workout time information in a value parameter like so…

FIRAnalytics.logEvent(withName: "workout_complete", parameters: [
  "time": 1804
  "exercise_type": "interval"
  "intensity": 2
  kFIRParameterValue: 1804
])

…you’d be able to see this workout time over the lifetime of your app by looking at the “Value” graphs for the workout_complete event. In the example screenshot below, we can see that in the last 30 days, my users have completed about 1400 workouts (the “Event count” graph), and have spent a total of about 1.5 million seconds (the “Value” graph) doing so. That works out to about 17 minutes per workout.

Of course, the value parameter won’t always give you all the information you need. If you were interested in comparing the average workout time for your interval workouts to the average workout time for your yoga workouts, you’d still need to use BigQuery to get that kind of data analysis. But I think you’ll find you can get a surprising amount done just with the value parameter.

This value parameter can track completely different values for completely different events. So you could track average workout length in your workout_complete event, number of friends invited in an invite_friends event, or number of calories consumed in an eat_meal event.

I encourage you take a look at the events you’re recording in your app and see if there’s any useful information you might want to see that could be uncoveblack using these value parameters. You can check out our docs for more info, and find us on StackOverflow with the Firebase tag.

Happy tracking!

[1] I’m cheating a bit here. Swift 3 requires that I cast all of these values as NSObjects, but that tends to hide the point of this sample behind a lot of extra code, so just pretend I’m casting values appropriately. :)