Sitepoint.Matomo.Core
1.1.1
dotnet add package Sitepoint.Matomo.Core --version 1.1.1
NuGet\Install-Package Sitepoint.Matomo.Core -Version 1.1.1
<PackageReference Include="Sitepoint.Matomo.Core" Version="1.1.1" />
<PackageVersion Include="Sitepoint.Matomo.Core" Version="1.1.1" />
<PackageReference Include="Sitepoint.Matomo.Core" />
paket add Sitepoint.Matomo.Core --version 1.1.1
#r "nuget: Sitepoint.Matomo.Core, 1.1.1"
#:package Sitepoint.Matomo.Core@1.1.1
#addin nuget:?package=Sitepoint.Matomo.Core&version=1.1.1
#tool nuget:?package=Sitepoint.Matomo.Core&version=1.1.1
Sitepoint.Matomo.Core
Privacy-friendly Matomo analytics for Umbraco 13 โ with a twist: it tracks AI crawlers (ChatGPT, Claude, Perplexity, and friends) that classic JavaScript tracking never sees.
Features
- ๐งฉ Zero-config content model โ a
Matomocomposition (document type + data types) is installed automatically on first boot. - ๐ Client-side tracking โ drops the standard Matomo tracking snippet into your pages via a single partial view.
- ๐ค Server-side AI-agent tracking โ LLM crawlers run no JavaScript, so they're invisible to normal analytics. This package detects them by User-Agent and records the visit in Matomo server-side.
- ๐ Backoffice dashboard โ a Matomo section in the backoffice showing visitor and AI-crawler reports side by side, plus a health check that tells you whether your configuration is actually working.
- โ๏ธ Per-site configuration โ Site ID, Matomo URL, cookie and Do-Not-Track behaviour are edited by content editors in the backoffice, per content root.
- ๐ฆ Non-blocking โ AI hits are queued on a bounded background channel, so tracking never slows a response or throws into the request pipeline.
Requirements
- Umbraco 13 (
net8.0) - A reachable Matomo instance (Matomo 4 or 5)
Installation
dotnet add package Sitepoint.Matomo.Core
On the next application start, a package migration automatically imports the Matomo composition, its data types, and the tracking partial view. No manual schema setup is required.
Quick start
1. Apply the Matomo composition
In the backoffice, open the document type at the root of your site (e.g. Home) and add the Matomo composition to it. A new Matomo โ Configuration tab appears with these fields:
| Field | Alias | Purpose |
|---|---|---|
| Status | status |
Master switch for the client-side snippet. |
| SiteId | siteId |
The numeric website ID from Matomo (Administration โ Websites โ Manage). |
| MatomoUrl | matomoUrl |
Base URL of your Matomo install, e.g. https://analytics.example.com (no trailing slash, no /matomo.php). |
| Disable Cookies | disableCookies |
Emits disableCookies โ runs Matomo cookieless. |
| Do Not Track | doNotTrack |
Emits setDoNotTrack โ honours the browser DNT signal. |
Fill in SiteId and MatomoUrl, and turn Status on.
2. Add the tracking snippet to your layout
Render the partial once in your master layout, ideally in <head>:
@await Html.PartialAsync("matomo/tagManager")
The snippet only renders when Status is on and the configuration is valid, so it's safe to leave in place across environments.
3. Enable AI-agent tracking (optional)
To also record AI crawlers server-side, call AddAiTracking() when building Umbraco in Program.cs:
using Sitepoint.Matomo.Core.Extensions;
builder.CreateUmbracoBuilder()
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddComposers()
.AddAiTracking() // ๐ registers the AI-tracking middleware
.Build();
That's it โ the background worker and HTTP client are registered automatically by the package's composer.
4. Add an API token (optional)
Only needed to make the backoffice dashboard show reports. It has no effect on tracking โ both the client-side snippet and the server-side AI tracking work without it.
In Matomo, go to Administration โ Personal โ Security โ Create new token:
- The token's user must have view-only permission. The dashboard embeds Matomo's own widgets, and since Matomo 4 embedding only works with a view-only token โ if the user has write, admin or super-user access to even one site, Matomo returns an error instead of the report. Create a dedicated Matomo user with View access to the site and generate the token as that user; you cannot use your own admin account.
- Leave "Only allow secure requests" off. That option restricts the token to POST requests, and the dashboard loads reports as GET iframes โ with it enabled, your widgets will fail to load.
- The token is shown only once. Store it in user secrets or an environment variable as
Matomo:Token.
See Matomo's own guidance: What is the token_auth and where do I find it? ยท Requirements for embedding Matomo reports ยท Managing user permissions
Backoffice dashboard
Once installed, a Matomo section appears in the backoffice with one entry per site root that carries the Matomo composition. It shows:
- A health strip โ three at-a-glance checks: whether Site ID and Matomo URL are filled in, whether an API token is configured, and whether your Matomo server is actually reachable from the browser.
- Visitor tracking โ the Matomo visits summary for the last 30 days.
- Chatbot & AI tracking โ the visit log for the last 30 days. This is the raw visit log rather than a filtered summary, because Matomo has no segment for the raw user agent.
Both report cards are Matomo's own widgets embedded directly, so they need Matomo:Token to be set and your Matomo instance to permit framing.
AI-agent tracking
When a front-end request arrives with a known AI-crawler User-Agent, the middleware finds the nearest content node carrying the Matomo composition and sends a server-side hit to Matomo's tracking endpoint. Backoffice and /api requests are ignored.
Detected agents (matched case-insensitively as substrings):
ChatGPT-UserClaude-UserPerplexity-UserMistralAI-UserGemini-Deep-ResearchGoogleAgentNovaAct
Hits are placed on a bounded in-memory queue (capacity 1000, oldest dropped under pressure) and flushed by a hosted background service, so request latency is never affected.
Configuration
Application settings are read from the Matomo section of your app configuration:
{
"Matomo": {
"Token": "your_matomo_auth_token"
}
}
| Key | Description |
|---|---|
Matomo:Token |
Matomo token_auth, used only by the backoffice dashboard to load Matomo's reporting widgets. Tracking does not use it โ server-side AI hits are sent unauthenticated, which Matomo permits for the parameters this package sends. Optional; without it the dashboard reports won't load. Store it in user secrets or environment variables rather than committing it. |
Security note: the dashboard runs in the browser, so the token is served to any signed-in backoffice user and appears in report URLs. This is why Matomo requires a view-only token here โ it can read reports for the site and nothing more. Give the token's user View access to only the sites it needs, and rotate it if your access logs are shared.
Matomo's token guidelines:
- What is the token_auth and where can I find it? โ creating, storing and regenerating tokens
- Requirements for embedding Matomo reports โ the view-only rule the dashboard depends on
- Managing user permissions โ setting up a View-only user
- Tracking HTTP API reference โ which tracking parameters require authentication (none that this package sends)
Per-site values (Site ID, Matomo URL, cookie / DNT behaviour) live on the content node, not in appsettings.json, so different sites in a multi-site install can each point at their own Matomo configuration.
How it works
- Client-side:
matomo/tagManager.cshtmlreads the config from the site root and emits the Matomo_paqsnippet. - Server-side:
AddAiTracking()registers an Umbraco pipeline middleware โ detected AI requests are enqueued โ aBackgroundServicedrains the queue โ anHttpClient(5s timeout) issues the tracking call tomatomo.php. All failures are logged, never thrown. - Backoffice: a tree controller lists each site root carrying the Matomo composition; selecting one loads its Site ID, Matomo URL and API token from a backoffice endpoint and embeds Matomo's own reporting widgets.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- Umbraco.Cms.Web.BackOffice (>= 13.0.0 && < 14.0.0)
- Umbraco.Cms.Web.Website (>= 13.0.0 && < 14.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.