Setting up analytics events and conversions for mobile app
Most common situation: app running for half a year, Firebase connected, events flowing — but marketer opens dashboard and can't answer "how many users went from registration to first purchase". Because events exist but conversions aren't marked, funnel not set up, and purchase event fires with parameters that can't be segmented.
Setting up analytics events — not just "add Firebase.logEvent". This is designing data schema that later allows answering business questions.
Event schema design
Before writing code, create Event Taxonomy — table of all events with parameters:
| Event Name | Trigger | Parameters | Platform |
|---|---|---|---|
sign_up |
Successful registration | method (email/google/apple), source |
iOS, Android |
tutorial_complete |
Onboarding closed | steps_completed, skipped |
iOS, Android |
add_to_cart |
"Add to cart" clicked | item_id, item_name, price, currency, quantity |
iOS, Android |
purchase |
Successful payment | transaction_id, value, currency, items[] |
iOS, Android |
subscription_start |
First subscription payment | plan, trial, source |
iOS, Android |
Each event should answer specific question. If no question — no event.
Implementation: Firebase Analytics
// iOS — event with parameters
Analytics.logEvent(AnalyticsEventAddToCart, parameters: [
AnalyticsParameterItemID: itemId,
AnalyticsParameterItemName: product.name,
AnalyticsParameterPrice: product.price,
AnalyticsParameterCurrency: "RUB",
AnalyticsParameterQuantity: 1
])
// Purchase event (E-commerce schema)
Analytics.logEvent(AnalyticsEventPurchase, parameters: [
AnalyticsParameterTransactionID: orderId,
AnalyticsParameterValue: orderTotal,
AnalyticsParameterCurrency: "RUB",
AnalyticsParameterItems: items.map { item in
[
AnalyticsParameterItemID: item.id,
AnalyticsParameterItemName: item.name,
AnalyticsParameterPrice: item.price,
AnalyticsParameterQuantity: item.quantity
]
}
])
// Android — identical but via Bundle
val params = bundleOf(
FirebaseAnalytics.Param.TRANSACTION_ID to orderId,
FirebaseAnalytics.Param.VALUE to orderTotal,
FirebaseAnalytics.Param.CURRENCY to "RUB"
)
Firebase.analytics.logEvent(FirebaseAnalytics.Event.PURCHASE, params)
Using standard constants (AnalyticsEventPurchase, AnalyticsParameterTransactionID) instead of strings — not just style. Google automatically recognizes these events and activates enhanced e-commerce reports in Firebase Console and Google Analytics 4.
Conversions and key events
In Firebase Console → Events mark key events as Conversion Events (in GA4 — Key Events). This changes their display in reports and allows building funnels. Usually mark as conversions:
-
sign_up -
subscription_start -
purchase -
tutorial_complete(if onboarding critical for retention)
After marking event as conversion, data appears in Google Ads and allows optimizing campaigns toward real purchases, not just installs.
User Properties for segmentation
Events without context are low-value. User Properties allow audience segmentation:
Analytics.setUserProperty("premium", forName: "subscription_status")
Analytics.setUserProperty("ios_user", forName: "platform")
Analytics.setUserProperty(String(userAge / 10 * 10), forName: "age_bracket") // 20, 30, 40...
After setting User Properties can view conversions separately for premium users or build audiences in Firebase Audiences for Google Ads targeting.
Purchase event deduplication
One of most painful mistakes — double purchase from payment retry or restore purchases. Solution through transaction_id:
// Check if we already logged this transaction
if !UserDefaults.standard.bool(forKey: "logged_\(orderId)") {
Analytics.logEvent(AnalyticsEventPurchase, parameters: [...])
UserDefaults.standard.set(true, forKey: "logged_\(orderId)")
}
Firebase itself doesn't deduplicate events by transaction_id — must do on app side.
Event validation
Before shipping to production, check events through DebugView in Firebase Console. Enabled through:
# iOS Simulator
-FIRDebugEnabled
# Android
adb shell setprop debug.firebase.analytics.app com.myapp
DebugView shows events in real time with parameters. Must verify: all parameters passed, correct data types (number vs string), no typos in event names.
What's included in the work
- Event Taxonomy composition for entire app
- Event implementation on iOS and Android with correct parameters
- Conversion event setup in Firebase / GA4
- User Properties setup for segmentation
- Critical event deduplication (purchase, subscription)
- Validation through DebugView and Firebase Analytics Debugger
- Conversion transmission to Google Ads / Meta Ads
Timeline
Event schema and basic implementation for 10–15 events: 2–3 days. Full existing analytics audit + refactoring: 3–5 days. Cost calculated individually.







