Skip to content

Repository files navigation

goblog-plugin-analytics

A goblog WebAssembly plugin that adds the Google Analytics (gtag.js) snippet to the <head> of every page.

Install

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).

Settings

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.

Build it yourself

GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -ldflags="-s -w" -o plugin.wasm .
go test ./...   # native tests for the rendering

Needs Go 1.25 or newer. Implements the identity, settings and template_head exports; see goblog.live/docs/plugin-api.

License

Apache-2.0.

About

goblog plugin: the Google Analytics (gtag.js) snippet on every page (WebAssembly)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages