Skip to content

Firebase Setup

Enhance your BoostOps analytics with Firebase integration for more accurate revenue tracking, user behavior insights, and comprehensive game performance data.

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

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
  1. Go to Firebase Console → Your Project
  2. Navigate to Analytics → Events
  3. Enable Enhanced Measurement if not already enabled
  4. Verify data is flowing from your Unity game

For better BoostOps integration, create these custom events:

// Revenue events
boostops_purchase
boostops_ad_revenue
boostops_subscription
// Engagement events
boostops_level_complete
boostops_session_start
boostops_feature_used

If not already installed:

// Install Firebase Unity SDK
// Download from: https://firebase.google.com/download/unity
// Import Firebase Analytics package
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)
});
}
}

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

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);
}
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")}
};
}
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)
});
}
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());
}
}
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()}
});
}
}
}
  1. Run your game with both integrations active
  2. Perform test actions (purchases, level completion, etc.)
  3. Check Firebase Console → Analytics → Events
  4. Check BoostOps Dashboard → Real-time Events
  5. Verify data consistency between both platforms
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}");
}
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)}
});
}
}
}
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);
}
}
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);
}
  1. Check network connectivity and API permissions
  2. Verify Firebase project configuration
  3. Ensure both SDKs are properly initialized
  4. Check debug logs for error messages
  1. Verify currency consistency between systems
  2. Check timestamp synchronization
  3. Ensure duplicate prevention is working
  4. Review event mapping configuration
  1. Monitor app performance with both SDKs
  2. Optimize event batching settings
  3. Use background threads for data processing
  4. Consider data sampling for high-volume events

Ready to enhance your analytics? Configure Firebase integration →