Skip to main content
net10.0

This is a library that uses Google Analytics for ScissorHands.NET

Published
Sep 28, 2026
23d ago
Total Downloads
141
141

Install

dotnet add package ScissorHands.Plugin.GoogleAnalytics --version 1.0.0-preview.20260928.1
ProductVersions
.NET
net10.0

README

ScissorHands.NET: Google Analytics Plugin

Adds Google Analytics tag markup to a compatible ScissorHands.NET site.

Engine compatibility

Published and verified: ScissorHands.Plugin.GoogleAnalytics 1.0.0-preview.20260927.1 with ScissorHands.NET 1.0.0-preview.20260927.1. The release is available on NuGet.org; a clean NuGet-only consumer verified both integration paths. Plugin versions remain independent of engine versions. The sample still uses local project references for plugin development.

Replace removed Site.Locale/UseLocaleInUrl settings with ordered Site.Locales, or omit locales to disable localization. Every declared locale requires application Theme.Localization messages TranslationUnavailable, Draft, and ScheduledOn (with {0}). Remove frontmatter locale; primary content remains in the content root and translations go in declared additional-locale directories. See the versioned migration guide.

Analytics options, manifest enablement and preview behavior are unchanged. Neither integration changes language metadata, translation notices or publication badges. Custom layouts must preserve the engine's localization/publication rendering contract; analytics does not replace it.

Getting Started

Install the verified preview package in your ScissorHands.NET host:

dotnet add package ScissorHands.Plugin.GoogleAnalytics --version 1.0.0-preview.20260927.1

Add this entry to the Plugins array in appsettings.json. Replace G-EXAMPLE with your Google Analytics measurement ID for real tracking:

{
  "Plugins": [
    {
      "Id": "google-analytics",
      "Options": { "MeasurementId": "G-EXAMPLE" }
    }
  ]
}

In a layout supplied with the engine's cascading context, place the component just after the opening <head> tag:

<GoogleAnalyticsComponent Id="google-analytics" />

Alternatively, use the paired placeholder for the post-HTML hook:

<plugin:google-analytics></plugin:google-analytics>

Choose one path per insertion to avoid duplicates. Hook placeholders must be paired, not self-closing. The Id is exact and case-sensitive; an optional manifest Name is only a display label.

The hook replaces every paired marker case-insensitively and leaves unmarked HTML unchanged when configuration is valid. It does not deduplicate existing tags. The component refreshes its configuration when cascading context or selection changes and renders nothing when its selected manifest is absent.

Configuration and breaking migration

An enabled manifest requires a string MeasurementId: G- followed by one or more uppercase ASCII letters or digits, without whitespace. G-EXAMPLE is a supported synthetic value; syntax validation does not verify a Google property.

Both paths throw InvalidOperationException for missing or invalid identifiers, including null/non-string values and whitespace-padded input. The error identifies the plugin and option without exposing the supplied value. The hook validates even when no paired marker is present.

Breaking change: earlier versions accepted arbitrary strings and emitted an empty ID for missing or non-string values. Before upgrading, supply a supported identifier or remove the google-analytics manifest. Clearing the value or setting an unrelated Enabled option does not disable this plugin.

Preview and privacy

Configured output is retained in preview and production. Generation performs no provider request, but browsing generated pages can contact Google even with the fake ID. The plugin does not manage consent, suppress preview tracking, or provide provider retention/deletion controls. Remove its entry from Plugins to disable output.

See the technical requirements and evidence for validation, output handling and verification details.

Support

See the shared support and recovery policy for best-effort issue support and preview-release recovery.

Changes from Previous Version

No structural changes between v1.0.0-preview.20260927.1 and v1.0.0-preview.20260928.1.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.