FirebaseAnalytics.Maui 1.0.0

dotnet add package FirebaseAnalytics.Maui --version 1.0.0
                    
NuGet\Install-Package FirebaseAnalytics.Maui -Version 1.0.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="FirebaseAnalytics.Maui" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FirebaseAnalytics.Maui" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="FirebaseAnalytics.Maui" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FirebaseAnalytics.Maui --version 1.0.0
                    
#r "nuget: FirebaseAnalytics.Maui, 1.0.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.
#:package FirebaseAnalytics.Maui@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FirebaseAnalytics.Maui&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=FirebaseAnalytics.Maui&version=1.0.0
                    
Install as a Cake Tool

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

  1. Add NuGet package to your MAUI Blazor project:

    dotnet add package FirebaseAnalytics.Maui
    
  2. Add Firebase configuration files:

    • Android → Place google-services.json in Platforms/Android/
    • iOS → Place GoogleService-Info.plist in Platforms/iOS/
  3. 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 LogEvent parameters map directly to Firebase custom event parameters.
  • Firebase will batch and send events automatically in the background.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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