Intro to Analytics

Picture this: your friends and family have heard all about the amazing new app you’re about to launch (😄). Maybe you even have a waitlist of eager users who can’t wait to try it out. You’re excited to share it with everyone.

But wait!

Before you hit “Publish”, have you thought about how you’ll track user behavior in the app?

How will you know:

  • How many users complete onboarding?
  • How many have signed up and created an account?
  • How many have reached the paywall screen and bought a subscription?

Without analytics, you’re flying blind. You might be making critical decisions about your app’s future based on guesswork rather than data. In today’s competitive app market, that’s a risk you can’t afford to take.

The Importance of Analytics

Analytics provide a wealth of information that can drive your app’s success, including:

  • User Engagement: Understand how often users open your app, how long they stay, and which features they use most.
  • Retention Rates: Identify why users might be leaving and implement strategies to keep them coming back.
  • Feature Usage: See which parts of your app are most popular and which might need improvement or removal.
  • Revenue Insights: Track in-app purchases, subscription renewals, and other monetization metrics to optimize your business model.
  • User Demographics: Learn about your user base to tailor your app and marketing efforts more effectively.
  • User Journey: Map out how users navigate through your app, identifying both successful paths and potential roadblocks.

With these insights, you’re no longer guessing—you’re making data-driven decisions that can significantly improve your app’s user experience, retention, and overall success. In the competitive world of mobile apps, analytics isn’t just nice to have—it’s essential.

Making data-driven decisions with the Fake Door technique

When building my Flutter Tips app, I wanted to add a feature that would let users share individual Flutter tips with each other.

However, this feature wasn’t easy to implement and I didn’t know if users really wanted it.

So, before investing a lot of time and effort, I decided to add a share button that shows a “Not Implemented” alert when clicked (this technique is known as a “fake door”):

Example of an unimplemented feature in the Flutter Ship app

The catch here is that I can track an analytics event when the button is clicked.

This way, I can measure how many users try to use the feature over time, get quantitative data, and only build it for real if there’s enough interest.

This was just a simple example, but you can use fake doors more widely and decide which features to prioritize based on user demand, rather than “because the CEO says we need this”.

What we will cover

Analytics is a broad topic, so this module is divided into four parts.

1. Choosing an analytics provider

We’ll explore the mobile analytics landscape and identify popular services such as Firebase Analytics and Mixpanel, which offer good support for Flutter.

We’ll compare different analytics providers concerning their pricing models, features offered, ease of integration with Flutter, data privacy, and compliance with GDPR laws.

2. Architecture and Implementation Details for App Analytics

We’ll design a robust app analytics architecture and create a maintainable solution that supports:

  • Multiple analytics clients (to easily switch or use multiple vendors)
  • Event tracking with custom properties
  • Automatic screen tracking with a Flutter navigation observer
  • Enable/disable analytics data collection, giving more control to our users
  • Identify logged-in users via a unique ID

As part of this, we’ll also implement an AnalyticsLogger for local debugging and verification before switching to a real analytics service.

Here’s a preview:

App Analytics Architecture with Navigator Observer

3. Adding Mixpanel to a Flutter App

We’ll add Mixpanel (a powerful analytics platform) to the Flutter Ship app. We’ll cover:

  • Mixpanel Setup and Configuration: creating a project, obtaining API keys and storing them securely in Flutter, configuring environments (dev, staging, prod).
  • Flutter Integration: Adding the flutter_mixpanel package and initializing it in the app.
  • Implementing a MixpanelAnalyticsClient: creating a concrete implementation of the AnalyticsClient interface, implementing event tracking methods, and handling Mixpanel-specific features within the Flutter app.
  • Mixpanel Dashboard Overview: navigating the Mixpanel dashboard, creating and interpreting key reports, and using Mixpanel’s segmentation features for in-depth analysis.

By the end of this section, you’ll know how to integrate Mixpanel into your Flutter app, leverage its advanced features, and use its dashboard to gain valuable insights into user behavior.

4. Adding Firebase Analytics to a Flutter App

We’ll add Firebase Analytics support by covering:

  • FlutterFire CLI setup, so we can add multiple Firebase environments to the Flutter Ship app.
  • Firebase Analytics installation and setup, by implementing a FirebaseAnalyticsClient class that we can use for event and screen tracking.

This will give us more insights about the differences between Mixpanel and Firebase Analytics, so you can choose the most appropriate setup for your apps.

Summary

Ultimately, the goal of analytics is to better understand user behavior and engagement.

By the end of this section, you’ll be equipped with tools and techniques you can use to track what matters the most and make data-driven decisions in your apps.

Ready? Let’s get started! 🚀

Questions? Let's chat

⚠️