FirebaseAnalytics.Maui
1.0.0
dotnet add package FirebaseAnalytics.Maui --version 1.0.0
NuGet\Install-Package FirebaseAnalytics.Maui -Version 1.0.0
<PackageReference Include="FirebaseAnalytics.Maui" Version="1.0.0" />
<PackageVersion Include="FirebaseAnalytics.Maui" Version="1.0.0" />
<PackageReference Include="FirebaseAnalytics.Maui" />
paket add FirebaseAnalytics.Maui --version 1.0.0
#r "nuget: FirebaseAnalytics.Maui, 1.0.0"
#:package FirebaseAnalytics.Maui@1.0.0
#addin nuget:?package=FirebaseAnalytics.Maui&version=1.0.0
#tool nuget:?package=FirebaseAnalytics.Maui&version=1.0.0
Here is the properly formatted markdown for your Firebase Analytics .NET MAUI Blazor NuGet package README.md.
FirebaseAnalytics.Maui
A cross-platform Firebase Analytics service for .NET MAUI Blazor apps. Easily log analytics events and screen views from your Blazor pages with minimal setup.
📦 Installation
Add NuGet package to your MAUI Blazor project:
dotnet add package FirebaseAnalytics.MauiAdd Firebase configuration files:
- Android → Place
google-services.jsoninPlatforms/Android/ - iOS → Place
GoogleService-Info.plistinPlatforms/iOS/
- Android → Place
Enable Firebase Analytics in your Firebase Console.
⚙️ Setup
In your MauiProgram.cs file, register the Firebase Analytics service:
using FirebaseAnalytics.Maui;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
// Register Firebase Analytics service
builder.Services.AddFirebaseAnalytics();
return builder.Build();
}
}
🚀 Usage
Log a Custom Event
You can inject the IFirebaseAnalyticsService to log custom events anywhere in your Blazor pages.
@page "/"
@inject IFirebaseAnalyticsService Analytics
<h3>Home</h3>
<button @onclick="TrackEvent">Log Purchase</button>
@code {
void TrackEvent()
{
Analytics.LogEvent("purchase", new()
{
{ "item_id", "123" },
{ "price", "19.99" }
});
}
}
Log a Screen View
To manually log a screen view, inject the service and call LogScreenView.
@page "/product"
@inject IFirebaseAnalyticsService Analytics
<h3>Product Page</h3>
@code {
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
Analytics.LogScreenView("Product Page");
}
}
}
🔄 Automatic Screen Tracking (Optional)
For automatic page navigation tracking, you can inject NavigationManager and subscribe to the LocationChanged event.
@inject NavigationManager Nav
@inject IFirebaseAnalyticsService Analytics
@code {
protected override void OnInitialized()
{
Nav.LocationChanged += (s, e) =>
{
var pageName = Nav.Uri.Split('/').LastOrDefault() ?? "Home";
Analytics.LogScreenView(pageName);
};
}
}
📌 Notes
- This package supports Android and iOS.
- Other platforms use a no-op implementation, ensuring your code compiles everywhere without errors.
- The
LogEventparameters map directly to Firebase custom event parameters. - Firebase will batch and send events automatically in the background.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- No dependencies.
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 |
|---|---|---|
| 1.0.0 | 232 | 8/11/2025 |