Matomo.Xamarin.Forms 1.1.0

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

// Install Matomo.Xamarin.Forms as a Cake Tool
#tool nuget:?package=Matomo.Xamarin.Forms&version=1.1.0

Matomo.Xamarin.Forms

This library provides Matomo Tracking for Xamarin.Forms Apps.

Status

Continuous Integration

Initial Setup

Getting started with Matomo.Xamarin.Forms is pretty easy:

  1. Add the Matomo.Xamarin.Forms Nuget to your project

  2. In your App.xaml.cs add:

private static object _matomoSyncRoot = new object();
private static MatomoAnalytics _matomoAnalytics;
public static MatomoAnalytics MatomoAnalytics
{
    get
    {
        lock (_matomoSyncRoot)
            if (_matomoAnalytics == null)
            {
                _matomoAnalytics = new MatomoAnalytics("https://url.to.matomo.instance/", 1);
                _matomoAnalytics.AppUrl = "https://app/";
            }
        return _matomoAnalytics;
     }
}

The code above connects your app to site number 1 on your Matomo instance, change the Url and the Site ID accordingly. In addition this code will Expose the MatomoAnalytics class to your App by just calling App.MatomoAnalytics.

  1. In your App.xaml.cs OnSleep Method add:
MatomoAnalytics.LeavingTheApp();

The library will batch submit the tracking data upon the app going into Background, without this call you will not receive any Tracking Data!

  1. When using Shell navigation tracking page visits is made simple with the ShellHelper: Add to your OnAppearing methods the following call:
App.MatomoAnalytics.TrackPage(Shell.Current.Title, ShellHelper.Instance.CurrentPath);

ShellHelper.Instance.CurrentPath generates you the full path to the Page you are currently starting to watch.

Documentation

You can find a reference documentation here.

And a sample project in the Sample/ folder.

Credit

This work is based on the work done at zauberzeug/xamarin.piwik

License

This project retains the MIT license as per the original project.

Support

In case of issues with the library feel free to provide feedback via the Issues tab or if you want to support the project feel free to contribute via Pull Request.

If you need assistance getting started with Matomo and .NET MAUI feel free to reach out.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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.1.0 204 3/15/2023
1.1.0-pre001 131 3/15/2023
1.0.0 186 2/23/2023
1.0.0-pre002 98 2/23/2023