Skip to content

Switch analytics to Stape server-side GTM#594

Merged
danbarr merged 2 commits intomainfrom
add-server-side-gtm
Mar 6, 2026
Merged

Switch analytics to Stape server-side GTM#594
danbarr merged 2 commits intomainfrom
add-server-side-gtm

Conversation

@danbarr
Copy link
Collaborator

@danbarr danbarr commented Mar 6, 2026

Description

Migrates site analytics from client-side Google Tag Manager to Stape's server-side GTM service. Rather than loading scripts directly from Google's servers, analytics requests are proxied through a Stape-hosted endpoint aliased under the stacklok.com domain (mm.stacklok.com). Server-side GTM is a more privacy-friendly approach, as it reduces direct data exposure to third-party scripts in the browser.

Because the new integration uses an inline loader script rather than an external script URL, the implementation moves from the scripts config array (which only supports src URLs) to a Docusaurus inline plugin using injectHtmlTags. This also allows the required GTM <noscript> fallback tag to be injected correctly into <body>.

Type of change

  • Other: backend/internal update

Signed-off-by: Dan Barr 6922515+danbarr@users.noreply.github.com

Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 6, 2026 16:29
@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-website Ready Ready Preview, Comment Mar 6, 2026 4:40pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the site's Google Tag Manager integration from client-side GTM (via Docusaurus's built-in preset-classic googleTagManager option) to Stape's server-side GTM service. Analytics requests are now proxied through a first-party subdomain (mm.stacklok.com) rather than loading scripts directly from Google's servers, which is a more privacy-friendly approach.

Changes:

  • Replaced the googleTagManager preset option with a custom inline Docusaurus plugin that uses injectHtmlTags to inject both the Stape loader script (in <head>) and the GTM <noscript> fallback (in <body>).
  • Removed the googleTagManager: { containerId: 'GTM-W9MXGTF9' } configuration from the preset-classic options.
  • Added a descriptive comment to the HubSpot tracking script entry in the scripts array.

You can also share your feedback on Copilot code review. Take the survey.

Signed-off-by: Dan Barr <6922515+danbarr@users.noreply.github.com>
@danbarr danbarr marked this pull request as ready for review March 6, 2026 17:08
@danbarr danbarr enabled auto-merge (squash) March 6, 2026 17:10
@danbarr danbarr merged commit 0f6ccba into main Mar 6, 2026
3 checks passed
@danbarr danbarr deleted the add-server-side-gtm branch March 6, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants