DEV Community

swyx
swyx

Posted on

Firebase Analytics in 30 Seconds

Stacy Devino gave an excellent talk on Firebase Analytics today (slides here, github here, youtube intro here). There were a lot of aha moments:

  1. Integrating the Firebase SDK (Android and iOS and web) is just a few lines of code!

There are pre-configured events (send standard stuff like login attempts):

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(
    FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Enter fullscreen mode Exit fullscreen mode

and custom events (send whatever you want)

Bundle bundle = new Bundle();
bundle.putString("image_name", name);
mFirebaseAnalytics.logEvent("profile_image_select", bundle);
Enter fullscreen mode Exit fullscreen mode
  1. User grouping (so you can study how different groups of your users behave differently) is similarly just a few lines:
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mFirebaseAnalytics.setUserProperty("preferred_pet", 
    petSelector);
mFirebaseAnalytics.setUserId("userIdString");
Enter fullscreen mode Exit fullscreen mode
  1. Once your app is out in the wild, head to the Dashboard to see insights!

  2. Within the Dashboard, Streamview is particularly awesome as you can see the "clickstream" of user actions in sequence and visualize what they are doing (or failing to do) on your app!

  3. Everything above is completely free and unlimited for you to use. To do -really big- number crunching, you'll have to export the data outside of Firebase Analytics to Google BigQuery. There you will be able to query all your historical user data with plain SQL!

BigQuery is a freemium product so you'll have to have a credit card attached but the financial risk is low for most use cases: "Realistically, most people wouldn’t burn through the free GCP $ in the first year. 20k users and normal use <$5/month".

Having messed around with a few analytics products in my time as a product manager this looks extraordinarily easy to setup and get insights on, and I am looking forward to deploying this in ALL my Firebase hosted and serverless function projects!

Top comments (0)