Skip to content

Unity SDK Integration

Integrate BoostOps into your Unity game project in just a few minutes. Our SDK is designed to be lightweight, easy to use, and compatible with your existing analytics setup.

Before you begin, ensure you have:

  • Unity 2019.4 LTS or later (recommended: Unity 2021.3 LTS+)
  • iOS 10.0+ or Android API level 19+ target
  • BoostOps account with Game ID and API Key
  • Firebase project (optional but recommended for enhanced tracking)
  1. Open Unity Package Manager

    • Go to WindowPackage Manager
    • Click the + button in top-left corner
    • Select Add package from git URL...
  2. Add BoostOps SDK

    https://github.com/boostops/unity-sdk.git
  3. Import the Package

    • Click Add and wait for the package to download
    • The SDK will appear in your Package Manager as “BoostOps Unity SDK”
  1. Download the Package

  2. Import into Unity

    • In Unity, go to AssetsImport PackageCustom Package
    • Select the downloaded .unitypackage file
    • Click Import to add all files
  1. Log into BoostOps Dashboard

  2. Generate SDK Keys

    • Go to SettingsSDK Integration
    • Click Generate New Keys if not already created
    • Copy both Game ID and API Key

Create a initialization script in your main game manager:

using UnityEngine;
using BoostOps;
public class GameManager : MonoBehaviour
{
[Header("BoostOps Configuration")]
[SerializeField] private string gameId = "YOUR_GAME_ID";
[SerializeField] private string apiKey = "YOUR_API_KEY";
[SerializeField] private bool enableDebugLogging = true;
void Start()
{
// Initialize BoostOps
BoostOpsSDK.Initialize(gameId, apiKey, enableDebugLogging);
// Optional: Set user properties
BoostOpsSDK.SetUserProperty("first_launch", System.DateTime.Now.ToString());
Debug.Log("BoostOps SDK initialized successfully");
}
}

Add essential game events to start tracking:

public class GameEvents : MonoBehaviour
{
void Start()
{
// Track game start
BoostOpsSDK.TrackEvent("game_start");
}
public void OnLevelComplete(int level)
{
// Track level completion with parameters
var parameters = new Dictionary<string, object>
{
{"level", level},
{"time_taken", Time.time},
{"score", GetCurrentScore()}
};
BoostOpsSDK.TrackEvent("level_complete", parameters);
}
public void OnInAppPurchase(string productId, float amount, string currency)
{
// Track revenue events (critical for profitability tracking)
var parameters = new Dictionary<string, object>
{
{"product_id", productId},
{"amount", amount},
{"currency", currency}
};
BoostOpsSDK.TrackRevenue("iap_purchase", amount, currency, parameters);
}
public void OnAdWatched(string placement, float rewardAmount = 0)
{
// Track ad events for monetization analysis
var parameters = new Dictionary<string, object>
{
{"placement", placement},
{"reward_amount", rewardAmount}
};
BoostOpsSDK.TrackEvent("ad_watched", parameters);
}
}

For better analytics and cross-platform tracking:

public void SetupUserIdentification()
{
// Set unique user ID (use your existing user system)
BoostOpsSDK.SetUserId("user_12345");
// Set user properties for segmentation
BoostOpsSDK.SetUserProperty("user_type", "premium");
BoostOpsSDK.SetUserProperty("registration_date", "2024-01-15");
BoostOpsSDK.SetUserProperty("total_purchases", 3);
}

Track metrics that matter for executive reporting:

public class ExecutiveMetrics : MonoBehaviour
{
public void TrackSessionMetrics()
{
// Track session quality metrics
BoostOpsSDK.TrackEvent("session_start", new Dictionary<string, object>
{
{"session_length_target", 300}, // 5 minutes target
{"app_version", Application.version}
});
}
public void TrackRetentionMilestones(int daysSinceInstall)
{
// Track retention milestones for executive dashboard
if (daysSinceInstall == 1)
BoostOpsSDK.TrackEvent("day_1_retention");
else if (daysSinceInstall == 7)
BoostOpsSDK.TrackEvent("day_7_retention");
else if (daysSinceInstall == 30)
BoostOpsSDK.TrackEvent("day_30_retention");
}
public void TrackRevenueMetrics(float totalSpent, string category)
{
// Critical for ad spend profitability calculations
BoostOpsSDK.TrackRevenue("user_spending", totalSpent, "USD",
new Dictionary<string, object>
{
{"category", category},
{"user_lifetime_value", CalculateUserLTV()}
});
}
}

Configure the SDK for optimal performance:

public void ConfigureSDKPerformance()
{
// Batch events for better performance
BoostOpsSDK.SetEventBatchSize(10);
// Set flush interval (seconds)
BoostOpsSDK.SetFlushInterval(30);
// Enable/disable based on build type
#if DEVELOPMENT_BUILD
BoostOpsSDK.EnableDebugLogging(true);
#else
BoostOpsSDK.EnableDebugLogging(false);
#endif
}

Add these entries to your Info.plist:

<dict>
<!-- Allow network access for analytics -->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>boostops.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>

Add permissions to your AndroidManifest.xml:

<manifest>
<!-- Required for analytics -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Optional: For better user tracking -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
void Start()
{
BoostOpsSDK.Initialize(gameId, apiKey, true);
// Check if initialization was successful
if (BoostOpsSDK.IsInitialized())
{
Debug.Log("✅ BoostOps SDK initialized successfully");
// Send test event
BoostOpsSDK.TrackEvent("sdk_test", new Dictionary<string, object>
{
{"test_timestamp", System.DateTime.UtcNow.ToString()},
{"unity_version", Application.unityVersion}
});
}
else
{
Debug.LogError("❌ BoostOps SDK initialization failed");
}
}

Enable debug logging to see SDK activity:

// Enable detailed logging in development
BoostOpsSDK.EnableDebugLogging(true);
// This will show:
// - Event tracking confirmations
// - Network request status
// - Error messages and warnings
  1. Run your game with the SDK integrated
  2. Perform test actions (start game, complete level, make purchase)
  3. Check BoostOps Dashboard → Real-time Events
  4. Verify events appear within 5-10 minutes
public class AnalyticsManager : MonoBehaviour
{
public static AnalyticsManager Instance { get; private set; }
void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
InitializeAnalytics();
}
else
{
Destroy(gameObject);
}
}
private void InitializeAnalytics()
{
BoostOpsSDK.Initialize(gameId, apiKey, enableDebugLogging);
}
public void TrackGameEvent(string eventName, Dictionary<string, object> parameters = null)
{
BoostOpsSDK.TrackEvent(eventName, parameters);
}
}
public static class GameAnalytics
{
public static void LevelStarted(int level, string difficulty)
{
BoostOpsSDK.TrackEvent("level_start", new Dictionary<string, object>
{
{"level", level},
{"difficulty", difficulty},
{"timestamp", Time.time}
});
}
public static void PurchaseCompleted(string productId, float price)
{
BoostOpsSDK.TrackRevenue("purchase", price, "USD",
new Dictionary<string, object>
{
{"product_id", productId}
});
}
}

SDK not initializing:

  • Verify your Game ID and API Key are correct
  • Check internet connectivity
  • Ensure you’re calling Initialize before other SDK methods

Events not appearing in dashboard:

  • Wait 5-10 minutes for data processing
  • Check debug logs for error messages
  • Verify your app is in foreground when sending events

Build errors:

  • Make sure Unity version is 2019.4+
  • Check that all required dependencies are installed
  • Try reimporting the BoostOps package

Ready to start tracking? Your executive dashboard will show data within 24 hours of integration.