Adds the Google Analytics (gtag.js) snippet to every page once you set your measurement ID.
35a083f395070e7f9f97e5385597e068291ccc38d7878837ead3847d7958acd8A goblog WebAssembly plugin that adds the Google Analytics (gtag.js) snippet to the <head> of every page.
From your goblog's Admin → Plugins → Browse, search for Google Analytics and click Install. Or download plugin.wasm from the latest release into plugins/wasm/ as analytics.wasm and restart goblog.
Upgrading from goblog ≤ 0.6.x, where this plugin was compiled in: install it from the directory and your existing measurement ID and enabled flag carry over (same plugin name, same setting keys).
Under Admin → Settings → Google Analytics:
| Setting | Default | Meaning |
|---|---|---|
tracking_id |
Your measurement ID, e.g. G-XXXXXXXXXX. Only letters, digits and - are accepted; anything else disables the snippet. |
|
enabled |
false |
Set to true to emit the snippet |
The snippet is only added when both are set. The plugin itself makes no network requests (allowed_hosts is empty) — the visitor's browser loads gtag.js.
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -ldflags="-s -w" -o plugin.wasm .
go test ./... # native tests for the renderingNeeds Go 1.25 or newer. Implements the identity, settings and template_head exports; see goblog.live/docs/plugin-api.
Apache-2.0.
analytics plugin that was compiled into goblog up to 0.6.x; the settings keys are unchanged, so an upgraded site keeps its measurement ID.<head> when enabled is true and tracking_id is set.Rewritten as a WebAssembly plugin, installable from the directory. Replaces the analytics plugin compiled into goblog up to 0.6.x; setting keys are unchanged so an upgraded site keeps its measurement ID.
GoBlog
Powered by goblog v0.16.0