SoftAgility.Beacon
3.2.1
dotnet add package SoftAgility.Beacon --version 3.2.1
NuGet\Install-Package SoftAgility.Beacon -Version 3.2.1
<PackageReference Include="SoftAgility.Beacon" Version="3.2.1" />
<PackageVersion Include="SoftAgility.Beacon" Version="3.2.1" />
<PackageReference Include="SoftAgility.Beacon" />
paket add SoftAgility.Beacon --version 3.2.1
#r "nuget: SoftAgility.Beacon, 3.2.1"
#:package SoftAgility.Beacon@3.2.1
#addin nuget:?package=SoftAgility.Beacon&version=3.2.1
#tool nuget:?package=SoftAgility.Beacon&version=3.2.1
SoftAgility Beacon — .NET SDK
The official .NET SDK for SoftAgility Beacon — a usage-tracking SaaS for desktop and server .NET applications. Send events, manage sessions, capture exceptions, and queue events offline. Buffered, batched, durable, and safe to call from any thread.
Installation
dotnet add package SoftAgility.Beacon
Runs almost anywhere: the package multi-targets .NET 6/7/8/9/10, .NET Framework 4.8, and .NET Standard 2.0 (with a Windows-specific target for WinForms desktop apps). Whether you ship a legacy WinForms app on the .NET Framework or a modern .NET 10 service, the integration is identical and the wire format is the same.
Quick start (with Microsoft.Extensions.DependencyInjection)
using SoftAgility.Beacon;
var services = new ServiceCollection();
services.AddBeacon(options =>
{
options.ApiKey = "pk_your_api_key";
options.ApiBaseUrl = "https://api.beacon.softagility.com";
options.Product = "MyApp"; // the registered product; sent as the `product` field on every event
options.ProductVersion = "1.4.2"; // becomes product_version on every event
// Optional — declare the events your app emits, then export the manifest
// for upload to the portal's Allowlists > Import page.
options.Events
.Define("auth", "user.signed-in")
.Define("billing", "checkout.completed")
.Define("ui", "dashboard.viewed");
});
var provider = services.BuildServiceProvider();
// Resolve once and use as a singleton — thread-safe
var beacon = provider.GetRequiredService<IBeaconTracker>();
// Identify the current user (does NOT block; sets actor id for subsequent calls)
beacon.Identify("user-12345");
// Track an event
beacon.Track("billing", "checkout.completed", new { amount = 1990, currency = "USD" });
// Start / end a session
beacon.StartSession();
// ... user does things ...
beacon.EndSession();
// Report an unhandled exception (fire-and-forget; never throws)
try { /* risky work */ }
catch (Exception ex) { beacon.TrackException(ex, ExceptionSeverity.NonFatal); }
// On shutdown, flush any buffered events
await beacon.FlushAsync();
Quick start (without DI)
var options = new BeaconOptions
{
ApiKey = "pk_your_api_key",
ApiBaseUrl = "https://api.beacon.softagility.com",
Product = "MyApp",
ProductVersion = "1.4.2",
};
await using var beacon = new BeaconTracker(options);
beacon.Identify("user-12345");
beacon.Track("auth", "user.signed-in");
BeaconTracker is IAsyncDisposable — await using ensures any buffered events flush during disposal.
What the SDK does for you
| Behaviour | Detail |
|---|---|
| Buffered & batched | Events are queued in memory and flushed every FlushIntervalSeconds (default 60) in batches of MaxBatchSize (default 25). Background, non-blocking. |
| Durable on disk | Failed sends spill into a SQLite-backed disk queue (MaxQueueSizeMb, default 10 MB). Retries with exponential backoff. Survives process restarts. |
| Thread-safe | All public methods are safe to call concurrently. The tracker is registered as a singleton. |
| Anonymous-by-default | If you don't Identify, the SDK generates and reuses an anonymous device ID. Calling Identify later links the anonymous device to the identified actor (POST /v1/actors/identify). |
| Exception capture | TrackException(ex) enriches with stack trace, OS info, and a configurable breadcrumb buffer (MaxBreadcrumbs, default 25 — every Track call drops a breadcrumb). |
| Sessions | StartSession / EndSession send dedicated lifecycle events the portal stitches into session reports. |
| Opt-in / Opt-out | OptOut() persists the choice to disk and turns all subsequent calls into no-ops; OptIn() resumes. Idempotent and never throws. |
| Reset | Reset() clears identity + session + queue and rotates the anonymous device ID — used when a user logs out, or for "Forget me" UX. |
| Disabled mode | BeaconOptions.Enabled = false disables every method as a silent no-op. Useful for local dev. |
Configuration reference
| Option | Default | Range | Notes |
|---|---|---|---|
ApiKey |
required | — | API key from the Beacon portal. Sent as Authorization: Bearer. |
ApiBaseUrl |
required | — | Backend base URL. Trailing slash normalised. |
Product |
required | ≤128 chars | The registered product; sent as the product field on every event. Must match a registered product in the portal. |
ProductVersion |
required | ≤256 chars | Becomes product_version. Auto-registers on first event. |
Enabled |
true |
— | When false, every public method is a silent no-op. |
FlushIntervalSeconds |
60 |
1-3600 | Background flush cadence. |
MaxBatchSize |
25 |
1-1000 | Events per HTTP batch. |
MaxQueueSizeMb |
10 |
1-1000 | SQLite disk-queue cap. |
MaxBreadcrumbs |
25 |
0-200 | Breadcrumb ring-buffer size. 0 disables breadcrumbs. |
Events |
EventDefinitionBuilder |
— | Declarative event registry; export via ExportEventManifest. |
Logger |
null |
— | Optional Microsoft.Extensions.Logging.ILogger for SDK diagnostics. |
Compatibility
As of 3.2.0, the package ships five target frameworks:
net8.0— base library; consumed by .NET 8, 9, and 10 (any platform)net8.0-windows— same library withUseWindowsForms = true, for WinForms desktop apps on modern .NETnet6.0— for .NET 6 and 7 appsnetstandard2.0— for .NET Standard 2.0 consumers (older .NET Core, Mono, Unity, mixed legacy libraries)net48— for .NET Framework 4.8 apps (WinForms/WPF/console on the classic framework)
NuGet's automatic best-match resolution picks the right TFM at install time — no manual selection needed. (3.0.0–3.1.0 shipped net8.0/net8.0-windows only; 3.2.0 broadened the matrix with no public-API or wire-format change.)
Examples
A working WinForms example app lives at examples/winforms/ — covers DI registration, Identify, Track, sessions, exception reporting, and graceful shutdown. References SoftAgility.Beacon via NuGet (1.0.1), so it builds standalone after dotnet restore.
Related
- Beacon portal: https://beacon.softagility.com
- Other SDKs: JavaScript / TypeScript, C++
- REST API: integrate without an SDK by POSTing to
/v1/eventsdirectly - Source: https://github.com/softagility/beacon-sdk-dotnet
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.Data.Sqlite (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Memory (>= 4.5.5)
- System.Text.Json (>= 8.0.5)
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.Data.Sqlite (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Memory (>= 4.5.5)
- System.Text.Json (>= 8.0.5)
-
net6.0
- Microsoft.Data.Sqlite (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Text.Json (>= 8.0.5)
-
net8.0
- Microsoft.Data.Sqlite (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
-
net8.0-windows7.0
- Microsoft.Data.Sqlite (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.