{"id":21838402,"url":"https://github.com/aptabase/aptabase-maui","last_synced_at":"2025-04-14T10:24:11.353Z","repository":{"id":167589259,"uuid":"624450231","full_name":"aptabase/aptabase-maui","owner":"aptabase","description":"MAUI SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps","archived":false,"fork":false,"pushed_at":"2024-09-03T05:21:29.000Z","size":216,"stargazers_count":10,"open_issues_count":5,"forks_count":7,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T23:41:46.814Z","etag":null,"topics":["analytics","maui","net8","privacy","sdk"],"latest_commit_sha":null,"homepage":"https://aptabase.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aptabase.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-06T13:49:29.000Z","updated_at":"2024-09-01T14:06:38.000Z","dependencies_parsed_at":"2024-06-01T19:46:47.566Z","dependency_job_id":"07a19fca-b2e5-4eb2-a040-6c7a41512072","html_url":"https://github.com/aptabase/aptabase-maui","commit_stats":null,"previous_names":["aptabase/aptabase-maui"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-maui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-maui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-maui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-maui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aptabase","download_url":"https://codeload.github.com/aptabase/aptabase-maui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860755,"owners_count":21173497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","maui","net8","privacy","sdk"],"created_at":"2024-11-27T21:10:55.458Z","updated_at":"2025-04-14T10:24:11.331Z","avatar_url":"https://github.com/aptabase.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Aptabase](https://raw.githubusercontent.com/aptabase/aptabase-com/main/public/og.png)\n\n# MAUI SDK for Aptabase\n\n[![NuGet](https://img.shields.io/nuget/v/Aptabase.Maui)](https://www.nuget.org/packages/Aptabase.Maui) \n[![GitHub](https://img.shields.io/github/license/aptabase/aptabase-maui)](https://github.com/aptabase/aptabase-maui/blob/main/LICENSE)\n\nInstrument your apps with Aptabase, an Open Source, Privacy-First and, Simple Analytics for Mobile, Desktop and, Web Apps.\n\n## Install\n\nStart by adding the Aptabase NuGet package to your .csproj:\n\n```xml\n\u003cPackageReference Include=\"Aptabase.Maui\" Version=\"0.1.0\" /\u003e\n```\n\n## Usage\n\nFirst, you need to get your `App Key` from Aptabase, you can find it in the `Instructions` menu on the left side menu.\n\nChange your `MauiProgram.cs` to add Aptabase to the build pipeline:\n\n```csharp\npublic static MauiApp CreateMauiApp()\n{\n    var builder = MauiApp.CreateBuilder();\n    builder\n        .UseMauiApp\u003cApp\u003e()\n        .UseAptabase(\"\u003cYOUR_APP_KEY\u003e\", new AptabaseOptions // 👈 this is where you enter your App Key\n        {\n#if DEBUG\n            IsDebugMode = true,\n#else\n            IsDebugMode = false,\n#endif\n            EnableCrashReporting = true, // 👈 log app crashes, unhandled exceptions \n            EnablePersistence = true, // 👈 persist events on disk before sending them to the server\n        })\n    ...\n}\n```\n\nThe `UseAptabase` method will add the `IAptabaseClient` to your dependency injection container, allowing you to use it in your pages and view models.\n\nAs an example, to track events in your `MainPage`, you first need to add it to the DI Container in `MauiProgram.cs`:\n\n```csharp\nbuilder.Services.AddSingleton\u003cMainPage\u003e();\n```         \n\nAnd then inject and use it on your `MainPage.xaml.cs`:\n\n```csharp\npublic partial class MainPage : ContentPage\n{\n    IAptabaseClient _aptabase;\n    int count = 0;\n\n    public MainPage(IAptabaseClient aptabase)\n    {\n        InitializeComponent();\n        _aptabase = aptabase;\n    }\n\n    private void OnCounterClicked(object sender, EventArgs e)\n    {\n        count++;\n        _aptabase.TrackEvent(\"Increment\");\n\n        if (count == 1)\n            CounterBtn.Text = $\"Clicked {count} time\";\n        else\n            CounterBtn.Text = $\"Clicked {count} times\";\n\n        SemanticScreenReader.Announce(CounterBtn.Text);\n    }\n}\n```\n\nThe `TrackEvent` method also supports custom properties:\n\n```csharp\n_aptabase.TrackEvent(\"app_started\"); // An event with no properties\n_aptabase.TrackEvent(\"screen_view\", new() {  // An event with a custom property\n    { \"name\", \"Settings\" }\n});\n```\n\nA few important notes:\n\n1. The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.\n2. You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call `TrackEvent` manually.\n   - Because of this, it's generally recommended to at least track an event at startup\n3. The `TrackEvent` function is a non-blocking operation as it runs in the background.\n4. Only strings and numbers values are allowed on custom properties\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faptabase%2Faptabase-maui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faptabase%2Faptabase-maui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faptabase%2Faptabase-maui/lists"}