Firebase Setup
Enhance your BoostOps analytics with Firebase integration for more accurate revenue tracking, user behavior insights, and comprehensive game performance data.
Overview
Section titled “Overview”Firebase integration with BoostOps provides:
- Enhanced revenue tracking with Firebase Analytics events
- User behavior insights from Firebase user properties
- Cross-platform data consistency (iOS and Android)
- Real-time event streaming for immediate insights
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have:
- Firebase project set up for your game
- Firebase Analytics enabled and configured
- BoostOps Unity SDK already integrated
- Admin access to your Firebase console
Setup Process
Section titled “Setup Process”1. Firebase Console Configuration
Section titled “1. Firebase Console Configuration”Enable Required APIs
Section titled “Enable Required APIs”- Go to Firebase Console → Your Project
- Navigate to Analytics → Events
- Enable Enhanced Measurement if not already enabled
- Verify data is flowing from your Unity game
Create Custom Events (Optional)
Section titled “Create Custom Events (Optional)”For better BoostOps integration, create these custom events:
// Revenue eventsboostops_purchaseboostops_ad_revenueboostops_subscription
// Engagement eventsboostops_level_completeboostops_session_startboostops_feature_used2. Unity Integration
Section titled “2. Unity Integration”Firebase SDK Setup
Section titled “Firebase SDK Setup”If not already installed:
// Install Firebase Unity SDK// Download from: https://firebase.google.com/download/unity// Import Firebase Analytics packageBoostOps + Firebase Integration
Section titled “BoostOps + Firebase Integration”using UnityEngine;using BoostOps;using Firebase.Analytics;
public class AnalyticsManager : MonoBehaviour{ void Start() { // Initialize both SDKs BoostOpsSDK.Initialize("YOUR_GAME_ID", "YOUR_API_KEY"); FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
// Enable Firebase integration in BoostOps BoostOpsSDK.EnableFirebaseIntegration(true); }
public void TrackPurchase(string productId, float amount, string currency) { // Track in both systems for comprehensive data
// BoostOps tracking (for profitability analysis) BoostOpsSDK.TrackRevenue("purchase", amount, currency, new Dictionary<string, object> { {"product_id", productId}, {"source", "firebase_integration"} });
// Firebase tracking (for user behavior analysis) FirebaseAnalytics.LogEvent("boostops_purchase", new Parameter[] { new Parameter("product_id", productId), new Parameter("value", amount), new Parameter("currency", currency) }); }}3. Data Synchronization
Section titled “3. Data Synchronization”Automatic Event Forwarding
Section titled “Automatic Event Forwarding”Enable automatic forwarding of Firebase events to BoostOps:
public class FirebaseBoostOpsSync : MonoBehaviour{ void Start() { // Enable automatic sync BoostOpsSDK.EnableFirebaseSync(new string[] { "purchase", "ad_impression", "level_complete", "session_start" }); }}Custom Event Mapping
Section titled “Custom Event Mapping”Map Firebase events to BoostOps events:
public void ConfigureEventMapping(){ var eventMapping = new Dictionary<string, string> { {"firebase_purchase", "boostops_revenue"}, {"firebase_level_up", "boostops_progression"}, {"firebase_ad_impression", "boostops_monetization"} };
BoostOpsSDK.SetFirebaseEventMapping(eventMapping);}Enhanced Analytics
Section titled “Enhanced Analytics”Revenue Tracking
Section titled “Revenue Tracking”In-App Purchases
Section titled “In-App Purchases”public void OnPurchaseComplete(string productId, float price, string currency){ // Enhanced revenue tracking with Firebase context var parameters = new Dictionary<string, object> { {"product_id", productId}, {"firebase_user_id", FirebaseAnalytics.AppInstanceId}, {"user_properties", GetFirebaseUserProperties()}, {"session_id", GetCurrentSessionId()} };
BoostOpsSDK.TrackRevenue("iap_purchase", price, currency, parameters);}
private Dictionary<string, object> GetFirebaseUserProperties(){ return new Dictionary<string, object> { {"user_level", FirebaseAnalytics.GetUserProperty("user_level")}, {"user_type", FirebaseAnalytics.GetUserProperty("user_type")}, {"days_since_install", FirebaseAnalytics.GetUserProperty("days_since_install")} };}Ad Revenue Integration
Section titled “Ad Revenue Integration”public void OnAdRevenueReceived(string adNetwork, string placement, float revenue){ // Track ad revenue with Firebase context var parameters = new Dictionary<string, object> { {"ad_network", adNetwork}, {"placement", placement}, {"firebase_user_id", FirebaseAnalytics.AppInstanceId}, {"user_segment", GetUserSegment()} };
BoostOpsSDK.TrackRevenue("ad_revenue", revenue, "USD", parameters);
// Also log to Firebase for cross-reference FirebaseAnalytics.LogEvent("boostops_ad_revenue", new Parameter[] { new Parameter("ad_network", adNetwork), new Parameter("placement", placement), new Parameter("value", revenue) });}User Behavior Analytics
Section titled “User Behavior Analytics”Enhanced User Properties
Section titled “Enhanced User Properties”public void SetEnhancedUserProperties(string userId){ // Set properties in both systems BoostOpsSDK.SetUserId(userId); FirebaseAnalytics.SetUserId(userId);
// Sync user properties var userProperties = new Dictionary<string, object> { {"registration_date", DateTime.Now.ToString()}, {"user_type", "premium"}, {"preferred_genre", "puzzle"}, {"platform", Application.platform.ToString()} };
foreach (var property in userProperties) { BoostOpsSDK.SetUserProperty(property.Key, property.Value); FirebaseAnalytics.SetUserProperty(property.Key, property.Value.ToString()); }}Session Tracking
Section titled “Session Tracking”public class SessionManager : MonoBehaviour{ private DateTime sessionStart;
void Start() { sessionStart = DateTime.Now;
// Track session start in both systems BoostOpsSDK.TrackEvent("session_start", new Dictionary<string, object> { {"firebase_session_id", GetFirebaseSessionId()}, {"app_version", Application.version} });
FirebaseAnalytics.LogEvent("boostops_session_start"); }
void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { // Track session end var sessionLength = (DateTime.Now - sessionStart).TotalSeconds;
BoostOpsSDK.TrackEvent("session_end", new Dictionary<string, object> { {"session_length", sessionLength}, {"firebase_session_id", GetFirebaseSessionId()} }); } }}Data Validation
Section titled “Data Validation”Verify Integration
Section titled “Verify Integration”Check Data Flow
Section titled “Check Data Flow”- Run your game with both integrations active
- Perform test actions (purchases, level completion, etc.)
- Check Firebase Console → Analytics → Events
- Check BoostOps Dashboard → Real-time Events
- Verify data consistency between both platforms
Debug Mode
Section titled “Debug Mode”public void EnableDebugMode(){ // Enable debug logging for both systems BoostOpsSDK.EnableDebugLogging(true); FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
// Log integration status Debug.Log($"BoostOps Initialized: {BoostOpsSDK.IsInitialized()}"); Debug.Log($"Firebase App Instance ID: {FirebaseAnalytics.AppInstanceId}");}Data Consistency Checks
Section titled “Data Consistency Checks”Revenue Reconciliation
Section titled “Revenue Reconciliation”public class RevenueReconciliation : MonoBehaviour{ public void ValidateRevenueData() { // Compare revenue data between Firebase and BoostOps var firebaseRevenue = GetFirebaseRevenue(); var boostopsRevenue = GetBoostOpsRevenue();
if (Mathf.Abs(firebaseRevenue - boostopsRevenue) > 0.01f) { Debug.LogWarning($"Revenue mismatch: Firebase={firebaseRevenue}, BoostOps={boostopsRevenue}"); // Send alert to BoostOps for investigation BoostOpsSDK.TrackEvent("revenue_mismatch", new Dictionary<string, object> { {"firebase_revenue", firebaseRevenue}, {"boostops_revenue", boostopsRevenue}, {"difference", Mathf.Abs(firebaseRevenue - boostopsRevenue)} }); } }}Advanced Configuration
Section titled “Advanced Configuration”Custom Audiences
Section titled “Custom Audiences”Firebase Audience Sync
Section titled “Firebase Audience Sync”public void SyncFirebaseAudiences(){ // Sync Firebase audiences with BoostOps for better segmentation var audiences = GetFirebaseAudiences();
foreach (var audience in audiences) { BoostOpsSDK.SetUserProperty($"firebase_audience_{audience.name}", audience.value); }}Remote Config Integration
Section titled “Remote Config Integration”Dynamic Configuration
Section titled “Dynamic Configuration”public void ConfigureWithRemoteConfig(){ // Use Firebase Remote Config to control BoostOps settings var remoteConfig = FirebaseRemoteConfig.DefaultInstance;
var boostopsConfig = new Dictionary<string, object> { {"event_batch_size", remoteConfig.GetValue("boostops_batch_size").LongValue}, {"flush_interval", remoteConfig.GetValue("boostops_flush_interval").LongValue}, {"debug_mode", remoteConfig.GetValue("boostops_debug").BooleanValue} };
BoostOpsSDK.UpdateConfiguration(boostopsConfig);}Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Data Not Syncing
Section titled “Data Not Syncing”- Check network connectivity and API permissions
- Verify Firebase project configuration
- Ensure both SDKs are properly initialized
- Check debug logs for error messages
Revenue Discrepancies
Section titled “Revenue Discrepancies”- Verify currency consistency between systems
- Check timestamp synchronization
- Ensure duplicate prevention is working
- Review event mapping configuration
Performance Impact
Section titled “Performance Impact”- Monitor app performance with both SDKs
- Optimize event batching settings
- Use background threads for data processing
- Consider data sampling for high-volume events
Getting Help
Section titled “Getting Help”- BoostOps Support - Integration assistance
- Firebase Documentation - Firebase setup help
- Unity SDK Guide - Detailed Unity integration
- FAQ - Common questions and solutions
Ready to enhance your analytics? Configure Firebase integration →