Kingas.Aptabase 0.5.0

dotnet add package Kingas.Aptabase --version 0.5.0
NuGet\Install-Package Kingas.Aptabase -Version 0.5.0
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="Kingas.Aptabase" Version="0.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kingas.Aptabase --version 0.5.0
#r "nuget: Kingas.Aptabase, 0.5.0"
#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.
// Install Kingas.Aptabase as a Cake Addin
#addin nuget:?package=Kingas.Aptabase&version=0.5.0

// Install Kingas.Aptabase as a Cake Tool
#tool nuget:?package=Kingas.Aptabase&version=0.5.0

Aptabase

.NET SDK for Aptabase

THIS IS FORK OF https://github.com/aptabase/aptabase-maui TO REDUCE MAUI DEPENDENCY.

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="Kingas.Aptabase" Version="0.3" />

Usage

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

Need to configure IServiceCollection like:

services.AddSingleton<IAptabaseClient>(x =>
{
    var appKey = "<YOUR_APP_KEY>"; // // 👈 this is where you enter your App Key or read from config
    var logger = x.GetService<ILogger<AptabaseClient>>();
    return new AptabaseClient(appKey, null, logger);
});

You will add the IAptabaseClient to your dependency injection container, and this 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 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. 
.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 was computed.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 186 12/6/2023
0.4.0 68 12/6/2023
0.3.0 91 12/6/2023
0.2.0 99 12/6/2023
0.0.1 99 12/4/2023