Kingas.Aptabase
0.4.0
See the version list below for details.
dotnet add package Kingas.Aptabase --version 0.4.0
NuGet\Install-Package Kingas.Aptabase -Version 0.4.0
<PackageReference Include="Kingas.Aptabase" Version="0.4.0" />
paket add Kingas.Aptabase --version 0.4.0
#r "nuget: Kingas.Aptabase, 0.4.0"
// Install Kingas.Aptabase as a Cake Addin #addin nuget:?package=Kingas.Aptabase&version=0.4.0 // Install Kingas.Aptabase as a Cake Tool #tool nuget:?package=Kingas.Aptabase&version=0.4.0
.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:
- The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.
- 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
- The
TrackEvent
function is a non-blocking operation as it runs in the background. - Only strings and numbers values are allowed on custom properties
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. |
.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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.Net.Http.Json (>= 8.0.0)
-
net6.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.Net.Http.Json (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.Net.Http.Json (>= 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.