swyxio / swyxdotio

This is the repo for swyx's blog - Blog content is created in github issues, then posted on swyx.io as blog pages! Comment/watch to follow along my blog within GitHub
https://swyx.io
MIT License
336 stars 45 forks source link

Firebase Analytics in 30 Seconds #279

Closed swyxio closed 2 years ago

swyxio commented 2 years ago

source: devto devToUrl: "https://dev.to/swyx/firebase-analytics-in-30-seconds-6pp" devToReactions: 15 devToReadingTime: 2 devToPublishedAt: "2017-12-02T20:57:12.403Z" devToViewsCount: 604



title: Firebase Analytics in 30 Seconds published: true tags: inthirtyseconds, firebase, analytics

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);

and custom events (send whatever you want)

Bundle bundle = new Bundle();
bundle.putString("image_name", name);
mFirebaseAnalytics.logEvent("profile_image_select", bundle);
  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");
  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!