Firebase Analytics Tutorial for Developer & PM

Roy Ng @ Redso
RedSo
Published in
3 min readNov 20, 2017

--

You may face this situation:

Your client (or boss) want to track the user behaviours for an APP. They may know there is some tracking tools such as GA or Firebase. BUT they have no idea what’s the limitation and the correct way to track. As a developer, you will feel helpless when you asked to “track every pages and every buttons for me”. As a project manager, when your developer ask you for “tracking spec”, you don’t know how to draft it.

In this tutorial, I hope it can give some help to developer and project manager when they need to have a good tracking. (Normally the client and boss would not go deep and draft the tracking spec for you) So I think both the developer and PM should work together to make a good tracking. (PM have business sense [what to track] and developer have skills [how to track])

Event

Event is the core of Firebase Analytics. Most of things are tracked thru Event including screen views. Yes, there is NO screen tracking in Firebase Analytics. You must track the screen views by Event.

In this tutorial, we will use a job hunting app as example and use Swift (Android is more or less the same) as demo codes. In this app, login is required and the action of share job and apply job are most important actions for tracking.

There are some properties you should remember when using Event:

  • The event name should 1 to 40 alphanumeric characters or underscores
  • You can define up to 25 custom parameters per event
  • Up to 50 total event parameters per app (40 numeric and 10 textual)
  • Custom parameter name should up to 40 alphanumeric characters or underscores
  • Custom parameter value should up to 100 alphanumeric characters or underscores

Screen View

Basically you need to track the screen views first. It can tell you which screens are viewed most. The Firebase Analytics may track the screens by its own for you using the event: screen_view. But it’s not enough for a good tracking and will be explained in “Funnels” section.

So take the job hunting app as example, we will track the following:

  • s_signup
  • s_login
  • s_home
  • s_job_detail (params: job_id)
func trackScreen(name: String, parameters: [String: Any]?) {Analytics.setScreenName(name, screenClass: nil)Analytics.logEvent(name, parameters: parameters)}

As we track the screen view in separate events and Event support custom parameter. We can know more detail for screen view. e.g. The job detail page is tracked with s_job_detail and job_id is also put as parameter. In the event detail in Firebase Analytics, we can know which job is viewed most in detail.

Notes:

  • Screen should be tracked when the screen is appeared to user. e.g. Screen A -> Screen B -> back to Screen A. We should track view of screen A twice. (So we should track the screen in “onResume” or “viewDidAppear”)

Conversion = Important Event

We can mark the events as conversions for your important events.

  • Conversion events are uploaded immediately by the SDK
  • You may add up to 10 conversion events

I will track the followings in this example:

  • job_share
  • job_apply

User Properties

Beside the automatically collected user properties (e.g. Age, Country, Gender, OS Version…), you can define your important properties.

For example, for the job hunting app, the login type (Facebook / Google / Email) is important. So we can define “LoginType” as one of the property. And then for each event you can filter with user properties.

Add your custom properties carefully. It should be an important attribute for a user with a limited segmentation.

  • Good example: LoginType -> Facebook | Google | Email
  • Bad example: Favourite Number -> 1 , 2 , 3 … 999

Funnels

You can track the combination of events by using Funnels.

For example: s_job_detail -> job_share

By creating this Funnel, I can know how many user share the job in job detail page.

The advantage of user properties can be shown in here. You can filter the funnel using “LoginType”. Then you can track which kind of login type willing to share the job in job detail page.

Summary

  • Track your screens and actions using Event
  • Custom parameter is powerful but only up to 50 total event parameters
  • Mark your important events as Conversion which support real time data
  • Add User Properties which give you great segmentation reporting
  • Use Funnel to track the use behaviours in each screen

--

--

Roy Ng @ Redso
RedSo

Redso: Expert in building iPhone apps, Android apps, Mobile Web, scalable backend on Cloud Platforms, and integrating them all together.