Skip to content
IForevents Docs
IForevents Docs
HomeDashboardGitHubPrivacyTermsSecurityIntroduction
Support and SLA

.NET and Unity SDKs

The IForevents NuGet package for .NET and the UPM package for Unity

.NET

dotnet add package IForevents
dotnet add package IForevents.Segment   # optional adapters
dotnet add package IForevents.PostHog
using IForevents;

var analytics = await Iforevents.CreateAsync(Environment.GetEnvironmentVariable("IFOREVENTS_PROJECT_KEY")!);
await analytics.IdentifyAsync("user_123", new Dictionary<string, object?> { ["email"] = "[email protected]", ["plan"] = "pro" });
await analytics.TrackAsync("invoice_paid", new Dictionary<string, object?> { ["amount"] = 120, ["currency"] = "USD" });
await analytics.PageAsync("/pricing");
await analytics.ResetAsync();     // logout
await analytics.ShutdownAsync();  // drain before the process exits

Targets netstandard2.0 and net8.0. Register the Iforevents instance as a singleton in DI. ApiConfig: BaseUrl, BatchSize, FlushInterval, Timeout, MaxRetries / RetryDelay, RequeueFailedEvents, Storage / PersistQueue (FileStorage), ThrowOnError, OnQuotaExceeded, OnError, HttpClient. Exceptions: IForeventsApiException, IForeventsAuthException, IForeventsQuotaExceededException, IForeventsRateLimitedException.

Unity

Add the package by git URL in the Package Manager: https://github.com/innovafour/iforevents-sdks.git?path=/unity#unity/v0.1.0. It wraps the same .NET core with PlayerPrefs storage, SystemInfo context, delivery off the main thread and a flush on pause and quit (WebGL not yet supported).

IforeventsUnity.Init("pk_...", c => c.BatchSize = 20);
IforeventsUnity.Identify("player_123", new Dictionary<string, object> { ["plan"] = "free" });
IforeventsUnity.Track("level_completed", new Dictionary<string, object> { ["level"] = 3 });

Sources: iforevents-sdks/dotnet, iforevents-sdks/unity.

On this page

.NETUnity