Agent setup: authorize Sight MCP and ask your agent to call get_tracking_setup. It configures this integration automatically.

Google Tag Manager

A real, importable GTM Custom Template (sight-template.tpl) for Sight — so non-technical users can install pageview tracking without touching code, via GTM's own UI.

Part of Sight, split across repos under the sightapp org — see sightapp/sight-backend's SPEC.md for the full picture.

What this does

Fires a pageview to Sight's pixel endpoint (GET /t.gif?k=<key>&p=<path> — the same endpoint a plain <noscript><img> beacon would hit) using GTM's sandboxed sendPixel API. sendPixel is GET-only with no custom headers, which is exactly what /t.gif is designed for (API key in the query string, not a header) — see sight-backend's internal/api/tracker.go for the endpoint this mirrors.

Limitation: this only records pageviews, not arbitrary custom events with a JSON body — sendPixel can't POST. For custom events, use sight-js or the raw <script> tag's window.analytics.track() directly in your app instead of GTM.

Install

  1. In GTM, go to Templates → New → Import (the "⋮" menu) and select sight-template.tpl from this repo.
  2. Create a new Tag using the "Sight Analytics" template.
  3. Fill in your Sight API Key (from the dashboard's tracking snippet card) and leave Sight API URL as the default unless you're self-hosting.
  4. Set the trigger to All Pages (or History Change if your site is a SPA and you want route changes counted too).
  5. Publish the container.

Before you trust this in production

The .tpl's structure (___INFO___, ___TEMPLATE_PARAMETERS___, ___SANDBOXED_JS_FOR_WEB_TEMPLATE___, ___WEB_PERMISSIONS___) and API usage (sendPixel, getUrl, encodeUriComponent) are based on Google's own template docs and real published community templates. The send_pixel permission JSON was hand-written, not verified against a live GTM container from the session this was built in — after importing, open the template's Permissions tab in GTM and confirm it looks sane (GTM's own UI will flag/regenerate it if the shape is off). See sight-template.tpl's ___NOTES___ section for the same caveat inline.

Verify it worked

Publish the container, load a page, then check GET https://api.usesight.dev/api/v1/query/overview?days=1 (with your X-API-Key header) or the Sight dashboard — a pageview should show up within a few seconds. GTM's own Preview mode will also show the tag firing before you publish.

Source repository