Unity SDK for LoopKit analytics platform. Track events, identify users, and manage sessions with comprehensive analytics support.
This is the recommended installation method for Unity projects.
- Open your Unity project
- Go to Window → Package Manager
- Click the + button in the top-left corner
- Select Add package from git URL...
- Enter the following URL:
git@github.com:loopkitai/unity-sdk.git
- Open your Unity project
- Navigate to your project's
Packages
folder - Open the
manifest.json
file in a text editor - Add the following line to the
dependencies
section:"com.loopkit.sdk": "git@github.com:loopkitai/unity-sdk.git"
- Save the file and return to Unity
- Unity will automatically download and install the package
-
Clone the repository:
git clone git@github.com:loopkitai/unity-sdk.git
-
In Unity, go to Window → Package Manager
-
Click the + button and select Add package from disk...
-
Navigate to the cloned repository and select the
package.json
file in the root of the repository.
- Unity Version: 2020.3 or later
- Platform Support: All Unity-supported platforms
The easiest way to get started with LoopKit is using the LoopKitManager component:
- Add the Package (follow installation steps above)
- Create a GameObject: In your scene, create a new empty GameObject (right-click in Hierarchy → Create Empty)
- Add LoopKitManager Component: With the GameObject selected, click "Add Component" and search for "LoopKitManager"
- Paste Your API Key: In the LoopKitManager component, paste your API key from your LoopKit dashboard
- Done! LoopKit will automatically initialize and start tracking
Just by adding the LoopKitManager component, you automatically get these metrics tracked:
loopkit_initialized
- When the SDK starts upapp_paused
- When the app goes to backgroundapp_resumed
- When the app returns to foreground
application_focus_gained
- When the app gains focusapplication_focus_lost
- When the app loses focusapplication_start
- When the application startsapplication_quit
- When the application is quitting
session_start
- When a new session beginssession_end
- When a session ends (timeout or manual)- Automatic session tracking with 30-minute timeout
- Cross-scene session persistence
scene_loaded
- When a new scene loadsscene_unloaded
- When a scene is unloaded- Scene metadata (name, build index, load mode)
error
- Automatic Unity error and exception tracking- Error details with stack traces and scene context
fps_report
- Automatic FPS performance reports with statistics- Includes average, min, max, median FPS and low FPS percentage
- Configurable sampling and reporting intervals
low_memory_warning
- When device memory is running lowmemory_status
- Initial memory status on startup- Includes system memory, graphics memory, and available memory
network_connection_lost
- When internet connection is lostnetwork_connection_restored
- When internet connection is restorednetwork_status
- Initial network status on startup- Includes connection type (wifi, cellular, none) and reachability status
- Platform information (iOS, Android, etc.)
- Device details (model, memory, graphics)
- App version and Unity version
- Screen resolution and device type
If you need more control, you can also use the SDK programmatically:
using LoopKit;
public class GameManager : MonoBehaviour
{
void Start()
{
// Get the manager instance (if using LoopKitManager component)
LoopKitManager.Instance.Track("game_started");
// Or use the static API directly
LoopKitAPI.Track("level_completed", new Dictionary<string, object>
{
["level"] = 1,
["score"] = 1000,
["time"] = 45.2f
});
}
}
The LoopKitManager component provides these configuration options:
- API Key: Your LoopKit API key (required)
- Auto Initialize: Initialize automatically on Awake (default: true)
- Persist Across Scenes: Keep the GameObject alive when loading new scenes (default: true)
- Debug Mode: Enable debug logging (default: false)
- Batch Size: Number of events to batch before sending (default: 50)
- Flush Interval: How often to send events in seconds (default: 5)
- Session Tracking: Enable automatic session management (default: true)
- Scene Tracking: Track scene changes automatically (default: true)
- Error Tracking: Track Unity errors automatically (default: true)
- FPS Tracking: Track performance metrics automatically (default: true)
- Memory Tracking: Track memory warnings automatically (default: true)
- Network Tracking: Track connectivity changes automatically (default: true)
The SDK includes sample scenes demonstrating various features:
- SuperBasicExample: Simple event tracking with LoopKitManager
- BasicUsageExample: Comprehensive examples of all SDK features
- ManagerExample: Advanced LoopKitManager usage patterns
To import samples:
- Open Package Manager
- Find LoopKit Unity SDK in the list
- Expand the Samples section
- Click Import next to the desired sample
For detailed usage instructions and API reference, visit: LoopKit Unity Documentation
- Email: support@loopkit.ai
- Documentation: https://docs.loopkit.ai
- Website: https://loopkit.ai