CodeArt.MatomoTracking 1.0.0-preview3

This is a prerelease version of CodeArt.MatomoTracking.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeArt.MatomoTracking --version 1.0.0-preview3
                    
NuGet\Install-Package CodeArt.MatomoTracking -Version 1.0.0-preview3
                    
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="CodeArt.MatomoTracking" Version="1.0.0-preview3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeArt.MatomoTracking" Version="1.0.0-preview3" />
                    
Directory.Packages.props
<PackageReference Include="CodeArt.MatomoTracking" />
                    
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 CodeArt.MatomoTracking --version 1.0.0-preview3
                    
#r "nuget: CodeArt.MatomoTracking, 1.0.0-preview3"
                    
#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 CodeArt.MatomoTracking@1.0.0-preview3
                    
#: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=CodeArt.MatomoTracking&version=1.0.0-preview3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CodeArt.MatomoTracking&version=1.0.0-preview3&prerelease
                    
Install as a Cake Tool

Nuget

CodeArt.MatomoTracking

Opensource Matomo Tracking API for .NET. This library is based on the official Matomo Tracking API documentation: https://developer.matomo.org/api-reference/tracking-api and wraps the API calls in a simple to use .NET library. Initial version made by Allan Thraen for (CodeArt)[https://www.codeart.dk/].

Installation

Register the Matomo Tracking as a service in Dependency Injection.

        var services = new ServiceCollection();
        
        //Needs IConfiguration - but this might already be registered in your project
        services.AddScoped<IConfiguration>(_ => configuration);
		
        services.AddMatomoTracking(options =>
        {
            options.MatomoUrl = "https://[My matomo url]/";
            options.SiteId = "[My site id]";
        });
        var serviceProvider = services.BuildServiceProvider();

Configuration

If you have a configuration file, you can also set the configuration directly there under the "Matomo" node.

{
  "Matomo": {
	"MatomoUrl": "https://[My matomo url]/",
	"SiteId": "[My site id]"
  }
}

Usage

You can track many different things, for example:

  • Pageviews using PageViewTrackingItems
  • Events using EventTrackingItems
  • Ecommerce using EcommerceTrackingItems
  • Content using ContentTrackingItems

For the official documentation of what to track - and when, refer to the (official documentation)[https://developer.matomo.org/api-reference/tracking-api]

Tracking a page view


    await tracker.Track(new PageViewTrackingItem()
    {
        Url = "app://myapp/page1",
        UserID = "test@test.com",
        NewVisit = true,
        ActionName = "Page 1",
        PageViewID = pvid
    });

Tracking in bulk

You can also track multiple items in the same call like this:

    await tracker.Track(new PageViewTrackingItem()
    {
        Url = "app://myapp/page1",
        UserID = "test@test.com",
        NewVisit = true,
        ActionName = "Page 1",
        PageViewID = pvid
    },
    new EventTrackingItem()
    {
        Url = "app://myapp/page1",
        UserID = "test", 
        NewVisit = false,
        ActionName = "Form submit",
        PageViewID = pvid,
        EventCategory = "Form",
        EventAction = "Submit",
        EventName = "Newsletter form"
    });
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.  net9.0 was computed.  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. 
.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)
Included target framework(s) (in package)
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.0.5 17,418 5/3/2023
1.0.4 943 4/5/2023
1.0.3 472 2/20/2023
1.0.2 1,924 2/8/2023
1.0.1 572 1/28/2023
1.0.0 454 1/26/2023
1.0.0-preview3 326 1/26/2023
1.0.0-preview2 303 1/25/2023
1.0.0-preview1 291 1/25/2023