Skip to content

Enable GTM/cookie tracking on p3m.dev and packagemanager.posit.co - #182

Open
jstruzik wants to merge 1 commit into
posit-dev:mainfrom
jstruzik:fix-analytics-p3m-hosts
Open

Enable GTM/cookie tracking on p3m.dev and packagemanager.posit.co#182
jstruzik wants to merge 1 commit into
posit-dev:mainfrom
jstruzik:fix-analytics-p3m-hosts

Conversation

@jstruzik

@jstruzik jstruzik commented Jul 13, 2026

Copy link
Copy Markdown

What

Adds packagemanager.posit.co and p3m.dev to the hostname allowlist in _extensions/posit-docs/assets/_analytics.html, for both:

  • the Google Tag Manager (GTM-KHBDBW7) script injection, and
  • the OneTrust cookie preference center icon in the footer

This matches the existing docs.posit.co / netlify.app behavior. (includes("p3m.dev") also covers *.p3m.dev staging hosts.)

Why

Posit Package Manager vendors this theme and serves the docs under p3m.dev/__docs__ and packagemanager.posit.co/__docs__. Because the analytics snippet only activates on docs.posit.co/netlify.app, no GA4 data is collected for the PPM-hosted docs, even though the rest of those sites track fine. Reported in rstudio/package-manager#16379.

⚠️ Cookie-consent / WebOps gate

The README notes that cookie consent is managed by GTM and that WebOps must opt a site into tracking before the theme is bumped to enable it. This PR is the code half; it should not be released/merged until p3m.dev and packagemanager.posit.co are confirmed opted into GTM tracking. Flagging so the compliance step isn't skipped.

Follow-ups for maintainers

  • changelog.md entry + version bump on the next release (left to your release process).
  • Once released, PPM will re-vendor the extension to pick this up.

Testing

After a site is opted in and the theme is deployed, load https://p3m.dev/__docs__/ and confirm the GTM-KHBDBW7 container loads (GA4 real-time) and the cookie preference icon appears in the footer; verify docs.posit.co behavior is unchanged.

The GTM snippet and cookie preference center icon only activate on
docs.posit.co and netlify.app. Posit Package Manager serves this theme's
docs under p3m.dev/__docs__ and packagemanager.posit.co/__docs__, so no
Google Analytics data is collected there. Add both hosts to the allowlist
for the GTM script and the cookie preference center icon.

Note: enabling GTM on these hosts requires WebOps to opt them into
tracking (per README cookie-consent guidance) — coordinate before release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for product-doc-theme ready!

Name Link
🔨 Latest commit a2c2202
🔍 Latest deploy log https://app.netlify.com/projects/product-doc-theme/deploys/6a551953ddfca800089d625f
😎 Deploy Preview https://deploy-preview-182--product-doc-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant