Analytics
Osirion.Blazor.Analytics has one tracker component per analytics service. Each writes that service's tracking script
into the page from configuration. They render on the server, so they work under Static SSR with no interactive render
mode, and they live in the Osirion.Blazor.Analytics.Components namespace.
| Component | Service | Registration | Configuration section |
|---|---|---|---|
| ClarityTracker | Microsoft Clarity | AddClarity |
Osirion:Analytics:Clarity |
| GA4Tracker | Google Analytics 4 | AddGA4 |
Osirion:Analytics:GA4 |
| MatomoTracker | Matomo | AddMatomo |
Osirion:Analytics:Matomo |
| PlausibleTracker | Plausible | AddPlausible |
Osirion:Analytics:Plausible |
| UmamiTracker | Umami | AddUmami |
Osirion:Analytics:Umami |
| YandexMetricaTracker | Yandex Metrica | AddYandexMetrica |
Osirion:Analytics:YandexMetrica |
Plausible and Umami are available from 4.1.
Trackers inject third-party scripts, so these pages have no live demos: a demo would load the provider's script on the documentation page itself. Each page shows the markup its tracker renders instead.
What they share
@using Osirion.Blazor.Analytics.Components
<head>
<meta charset="utf-8" />
<base href="/" />
<HeadOutlet />
<GA4Tracker />
<ClarityTracker />
</head>
- Base class. All six derive from
AnalyticsTracker, which adds theSiteIdandEnabledparameters.Enabledset tofalseturns a tracker off for one render;SiteIdreplaces the configured site ID for the trackers that use one (Clarity, Matomo and Umami). A parameter you leave unset keeps the configured value. - Nothing renders by accident. A tracker whose service is not registered, whose
Enabledisfalse, or whose required value is missing or invalid, renders nothing. - Consent. The package has one consent gate, off by default. With it on, no tracker writes its script until the
visitor accepted the
analyticscategory inOsirionCookieConsent. Setup is on the package page. - Content Security Policy. Clarity, GA4, Matomo, Plausible and Yandex Metrica write inline scripts and add no nonce; Umami writes only an external script tag. Each page lists the addresses its markup names.
Related
- Osirion.Blazor.Analytics: install, registration, configuration and the consent gate
- Cookie consent: the banner that records the visitor's choice