Aptabase.Maui 0.0.8

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

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

Aptabase

MAUI SDK for Aptabase

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.Maui" Version="0.0.7" />

Usage

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>") // 👈 this is where you enter your App Key
    ...
}

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 net7.0 is compatible.  net7.0-android was computed.  net7.0-android33.0 is compatible.  net7.0-ios was computed.  net7.0-ios16.1 is compatible.  net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 is compatible.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net7.0-windows10.0.19041 is compatible.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net7.0-android33.0

    • No dependencies.
  • net7.0-ios16.1

    • No dependencies.
  • net7.0-maccatalyst16.1

    • No dependencies.
  • net7.0-windows10.0.19041

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

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

Repository Stars
MoneyFox/MoneyFox
A way to make budgeting easy. A basic idea for the community, made even better by the community.
Version Downloads Last updated
0.0.8 1,945 11/5/2023
0.0.7 1,406 8/29/2023
0.0.6 130 8/29/2023
0.0.5 416 5/21/2023
0.0.4 147 4/20/2023
0.0.3 144 4/17/2023
0.0.2 152 4/17/2023
0.0.1 148 4/17/2023