BrycensRanch.Aptabase.Core 0.2.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package BrycensRanch.Aptabase.Core --version 0.2.4
                    
NuGet\Install-Package BrycensRanch.Aptabase.Core -Version 0.2.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BrycensRanch.Aptabase.Core" Version="0.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BrycensRanch.Aptabase.Core" Version="0.2.4" />
                    
Directory.Packages.props
<PackageReference Include="BrycensRanch.Aptabase.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BrycensRanch.Aptabase.Core --version 0.2.4
                    
#r "nuget: BrycensRanch.Aptabase.Core, 0.2.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BrycensRanch.Aptabase.Core@0.2.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BrycensRanch.Aptabase.Core&version=0.2.4
                    
Install as a Cake Addin
#tool nuget:?package=BrycensRanch.Aptabase.Core&version=0.2.4
                    
Install as a Cake Tool

Aptabase

.NET SDK for Aptabase

NuGet GitHub

Instrument your apps with Aptabase, an Open Source, Privacy-First and, Simple Analytics for Mobile, Desktop and, Web Apps.

Install

Start by adding the Aptabase NuGet package to your .csproj:

<PackageReference Include="Aptabase.Core" Version="0.2.0" />

Or, if you're using MAUI

<PackageReference Include="Aptabase.Maui" Version="0.2.0" />

Usage (.NET)

First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.

Change your Program.cs to add Aptabase:

// Create a ServiceCollection
var services = new ServiceCollection();

services.AddLogging(); // If you haven't registered a logger yet

// Add Aptabase to the service collection
services.UseAptabase("<YOUR_APP_KEY>", new AptabaseOptions
{
#if DEBUG
   IsDebugMode = true,
#else
   IsDebugMode = false,
#endif
   EnableCrashReporting = false,  // ❌ Not supported with Aptabase.Core, only Aptabase.Maui 
   EnablePersistence = true,
});

// ... Register other services you need ...

// Build the service provider
var serviceProvider = services.BuildServiceProvider();

// Get an instance of the Aptabase service (if you need it directly)
var aptabaseClient = serviceProvider.GetRequiredService<IAptabaseClient>(); 
...
}

Usage (Maui)

First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.

Change your MauiProgram.cs to add Aptabase to the build pipeline:

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder
        .UseMauiApp<App>()
        .UseAptabase("<YOUR_APP_KEY>", new AptabaseOptions // 👈 this is where you enter your App Key
        {
#if DEBUG
            IsDebugMode = true,
#else
            IsDebugMode = false,
#endif
            EnableCrashReporting = true, // 👈 log app crashes, unhandled exceptions 
            EnablePersistence = true, // 👈 persist events on disk before sending them to the server
        })
    ...
}

The UseAptabase method will add the IAptabaseClient to your dependency injection container, allowing you to use it in your pages and view models.

As an example, to track events in your MainPage, you first need to add it to the DI Container in MauiProgram.cs:

builder.Services.AddSingleton<MainPage>();

And then inject and use it on your MainPage.xaml.cs:

public partial class MainPage : ContentPage
{
    IAptabaseClient _aptabase;
    int count = 0;

    public MainPage(IAptabaseClient aptabase)
    {
        InitializeComponent();
        _aptabase = aptabase;
    }

    private void OnCounterClicked(object sender, EventArgs e)
    {
        count++;
        _aptabase.TrackEvent("Increment");

        if (count == 1)
            CounterBtn.Text = $"Clicked {count} time";
        else
            CounterBtn.Text = $"Clicked {count} times";

        SemanticScreenReader.Announce(CounterBtn.Text);
    }
}

The TrackEvent method also supports custom properties:

_aptabase.TrackEvent("app_started"); // An event with no properties
_aptabase.TrackEvent("screen_view", new() {  // An event with a custom property
    { "name", "Settings" }
});

A few important notes:

  1. The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.
  2. You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call TrackEvent manually.
    • Because of this, it's generally recommended to at least track an event at startup
  3. The TrackEvent function is a non-blocking operation as it runs in the background.
  4. Only strings and numbers values are allowed on custom properties
Product Compatible and additional computed target framework versions.
.NET 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on BrycensRanch.Aptabase.Core:

Repository Stars
SnapXL/SnapX
SnapX is a free, open-source, cross-platform tool that lets you capture or record any area of your screen and instantly share it with a single keypress. Upload images, videos, text, and more to multiple supported destinations—all with ease. ShareX fork
Version Downloads Last Updated
0.2.5 76 9/26/2025
0.2.4 3,599 7/23/2025
0.2.3 1,119 7/17/2025
0.2.2 5,690 6/12/2025
0.2.1 301 6/12/2025
0.2.0 207 6/8/2025