0
0
Firebasecloud~15 mins

Custom events in Firebase - Deep Dive

Choose your learning style9 modes available
Overview - Custom events
What is it?
Custom events are user-defined actions or activities tracked in Firebase Analytics that go beyond the automatic events collected by default. They let you record specific interactions or behaviors unique to your app or website. This helps you understand how users engage with your product in ways that matter most to your goals.
Why it matters
Without custom events, you only see generic user actions, missing important details about how people use your app. Custom events solve this by capturing meaningful moments, like completing a purchase or sharing content. This insight helps improve user experience, marketing, and product decisions, making your app more successful.
Where it fits
Before learning custom events, you should understand basic Firebase Analytics and automatic event tracking. After mastering custom events, you can explore event parameters, user properties, and advanced analysis like funnels and audiences.
Mental Model
Core Idea
Custom events are like personalized notes you add to your app’s story to track exactly what matters to you.
Think of it like...
Imagine you run a store and want to know not just how many people enter, but who buys a specific product or asks for help. Custom events are like writing down these special moments in a notebook to learn more about your customers.
┌───────────────┐
│ User interacts│
│ with app      │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Firebase      │
│ Analytics     │
│ collects      │
│ automatic     │
│ events        │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Developer     │
│ defines       │
│ custom events │
│ for specific  │
│ actions       │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Custom events │
│ sent to       │
│ Firebase      │
│ Analytics     │
└───────────────┘
Build-Up - 7 Steps
1
FoundationWhat are Firebase events
🤔
Concept: Learn the basic idea of events in Firebase Analytics and how they track user actions automatically.
Firebase Analytics automatically tracks common user actions like app opens, screen views, and first visits without extra setup. These are called automatic events. They give a general picture of user behavior.
Result
You see basic reports about how users open and navigate your app.
Understanding automatic events sets the stage for why you might need to track more specific actions with custom events.
2
FoundationIntroduction to custom events
🤔
Concept: Custom events let you track actions unique to your app that automatic events don’t cover.
You can define your own events with names and send them to Firebase Analytics when users do something important, like completing a level or clicking a special button. This requires adding code to your app to log these events.
Result
Firebase Analytics starts collecting data on your custom events alongside automatic ones.
Knowing you can add your own events empowers you to tailor analytics to your app’s unique needs.
3
IntermediateNaming and sending custom events
🤔Before reading on: do you think event names can be any length or contain spaces? Commit to your answer.
Concept: Learn the rules for naming custom events and how to send them properly in code.
Event names must be lowercase, start with a letter, and can include underscores. They cannot have spaces or special characters. You send events using Firebase SDK methods like logEvent('event_name', {parameters}). For example, logEvent('purchase_complete', {item: 'shoes', price: 50}).
Result
Your app sends well-formed custom events that Firebase accepts and records.
Following naming rules prevents errors and ensures your events appear correctly in reports.
4
IntermediateUsing event parameters for detail
🤔Before reading on: do you think event parameters are required or optional? Commit to your answer.
Concept: Event parameters add extra information to custom events, making them richer and more useful.
Parameters are key-value pairs sent with events to describe details, like item names, prices, or levels completed. For example, logEvent('level_up', {level: 5, character: 'wizard'}). Parameters help you filter and analyze events in Firebase Analytics.
Result
You get detailed insights about user actions, not just counts.
Knowing how to use parameters unlocks deeper understanding of user behavior.
5
IntermediateViewing custom events in Firebase console
🤔
Concept: Learn how to find and analyze your custom events in Firebase Analytics reports.
After sending custom events, they appear in the Firebase console under Events. You can see counts, trends, and use parameters to filter data. It may take a few hours for new events to show up.
Result
You can monitor how often your custom events happen and gain insights.
Seeing your custom events in reports confirms your tracking works and guides decisions.
6
AdvancedLimits and best practices for custom events
🤔Before reading on: do you think you can send unlimited custom events with unlimited parameters? Commit to your answer.
Concept: Understand Firebase limits on custom events and how to design them wisely.
Firebase limits you to 500 different event names and 25 parameters per event. Avoid sending too many unique event names or parameters to prevent data loss. Use consistent naming and reuse parameters when possible. Plan events to capture meaningful actions without overload.
Result
Your analytics remain reliable and manageable without hitting limits.
Knowing limits helps you design efficient tracking that scales with your app.
7
ExpertAdvanced event usage and integration
🤔Before reading on: do you think custom events can trigger other Firebase features automatically? Commit to your answer.
Concept: Explore how custom events integrate with Firebase features like audiences, conversions, and Cloud Functions.
You can mark custom events as conversions to track key goals. Custom events can define audiences for targeted messaging. Also, Firebase Cloud Functions can trigger on custom events to run backend code, like sending notifications or updating databases. This creates powerful, automated workflows based on user behavior.
Result
Your app uses custom events not just for tracking but for dynamic responses and marketing.
Understanding integration unlocks the full power of custom events beyond simple analytics.
Under the Hood
When your app calls logEvent with a custom event name and parameters, the Firebase SDK packages this data and sends it to Firebase servers asynchronously. The servers process and store events in a scalable database. Later, the Firebase console queries this data to generate reports. Internally, events are timestamped and associated with user identifiers to build user behavior profiles.
Why designed this way?
Firebase designed custom events to be flexible so developers can track any action without waiting for Firebase to add new automatic events. The asynchronous sending avoids slowing down the app. Limits on event names and parameters protect the system from overload and keep analytics performant.
┌───────────────┐
│ App calls     │
│ logEvent()    │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Firebase SDK  │
│ packages and │
│ queues event │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Event sent to │
│ Firebase     │
│ servers      │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Events stored │
│ in database  │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Firebase     │
│ console      │
│ queries and  │
│ displays     │
│ reports      │
└───────────────┘
Myth Busters - 4 Common Misconceptions
Quick: do you think custom event names can contain spaces or uppercase letters? Commit to yes or no.
Common Belief:Custom event names can be any text, including spaces and uppercase letters.
Tap to reveal reality
Reality:Custom event names must be lowercase, start with a letter, and cannot contain spaces or special characters.
Why it matters:Using invalid names causes Firebase to ignore events or drop data, leading to missing analytics.
Quick: do you think you can send unlimited custom events without any limits? Commit to yes or no.
Common Belief:There are no limits on how many custom events or parameters you can send.
Tap to reveal reality
Reality:Firebase limits you to 500 unique event names and 25 parameters per event to ensure performance and data quality.
Why it matters:Exceeding limits causes events to be dropped silently, resulting in incomplete data and wrong conclusions.
Quick: do you think custom events automatically trigger marketing campaigns without extra setup? Commit to yes or no.
Common Belief:Sending a custom event automatically triggers Firebase marketing features like notifications.
Tap to reveal reality
Reality:Custom events must be explicitly linked to audiences or conversions and configured to trigger marketing actions.
Why it matters:Assuming automatic triggers leads to missed opportunities and wasted effort in campaign setup.
Quick: do you think custom events are sent instantly and always available immediately in reports? Commit to yes or no.
Common Belief:Custom events appear instantly in Firebase Analytics reports as soon as they are sent.
Tap to reveal reality
Reality:There is a delay of several hours before custom events appear in reports due to processing time.
Why it matters:Expecting immediate data can cause confusion and incorrect troubleshooting.
Expert Zone
1
Custom events can be combined with user properties to segment users dynamically, enabling powerful personalized experiences.
2
Event parameter names should be consistent across events to allow meaningful aggregation and comparison in reports.
3
Using Firebase Cloud Functions triggered by custom events enables server-side logic that can enrich analytics or automate workflows.
When NOT to use
Avoid using custom events for extremely high-frequency actions like every tap or scroll, as this can overwhelm analytics and increase costs. Instead, use automatic events or sampling. For complex user journeys, consider combining events with session tracking or external analytics tools.
Production Patterns
In production, teams define a clear event taxonomy with naming conventions and parameter standards. They mark key custom events as conversions to measure goals. Custom events often trigger Cloud Functions for real-time reactions, like sending welcome emails or updating CRM systems.
Connections
Event-driven architecture
Custom events in Firebase are a specific example of event-driven design where actions trigger reactions.
Understanding custom events helps grasp how systems respond to events asynchronously, a core idea in modern software design.
User behavior psychology
Custom events capture user actions that reflect motivations and habits.
Knowing how to track meaningful user actions connects technical analytics with understanding human behavior patterns.
Supply chain tracking
Both track discrete events along a process to understand flow and bottlenecks.
Seeing custom events like checkpoints in supply chains reveals how tracking events helps optimize complex systems.
Common Pitfalls
#1Using invalid event names with spaces or uppercase letters.
Wrong approach:logEvent('Purchase Complete', {item: 'book'})
Correct approach:logEvent('purchase_complete', {item: 'book'})
Root cause:Misunderstanding Firebase naming rules causes events to be ignored.
#2Sending too many unique event names exceeding Firebase limits.
Wrong approach:logEvent('button_click_1', {}); logEvent('button_click_2', {}); ... logEvent('button_click_600', {})
Correct approach:Use a single event like 'button_click' with parameters to distinguish buttons.
Root cause:Not planning event taxonomy leads to hitting limits and data loss.
#3Expecting custom events to appear instantly in reports.
Wrong approach:Checking Firebase console immediately after sending events and assuming no data if not visible.
Correct approach:Wait several hours for events to process and appear in reports.
Root cause:Lack of awareness about Firebase data processing delays.
Key Takeaways
Custom events let you track specific user actions that automatic events miss, giving you tailored insights.
Event names must follow strict rules to be accepted and recorded by Firebase Analytics.
Parameters add valuable detail to events, enabling deeper analysis of user behavior.
Firebase limits event names and parameters to keep analytics efficient and reliable.
Custom events can trigger powerful integrations like conversions, audiences, and backend functions for dynamic app behavior.