Skip to content

Load VWO on every docs page and report cookie consent to it (GRO-1076) - #1379

Open
tmashara wants to merge 1 commit into
masterfrom
gro-1076-track-vwo-experiment-attribution-across-the-website
Open

tmashara wants to merge 1 commit into
masterfrom
gro-1076-track-vwo-experiment-attribution-across-the-website

Conversation

@tmashara

@tmashara tmashara commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Docs counterpart of metabase/metabase.github.io#6645, same change. Closes GRO-1076. Decision and trade-offs: VWO vs mb_track (we chose approach A).

  • VWO now loads on every docs page (it used to need vwo: true, which no page set), so docs visits can be VWO goals.
  • We tell VWO the visitor's analytics consent (VWO.init(1 | 2 | 3)) so its "Partially Block" mode can hold tracking until consent.

Important

Ship together with metabase/metabase.github.io#6645. Right after both are deployed, switch on Enable Cookie Consent → Other → Partially Block in the VWO account. Until it's on, VWO ignores consent and tracks every visitor.

How to verify

  1. Start the docs dev server: bunx astro dev.
  2. In a private window, open http://localhost:4321/docs/latest/. Without seeded docs it renders the 404 page, which uses the same <head>, so that's fine for this check.
  3. DevTools → Network, filter visualwebsiteoptimizer, type All, tick Disable cache: j.php and collect/v.gif show that VWO is loaded.
  4. Console, window.VWO.consentState: 1 outside restricted countries, or 2 (pending) if you're in one.
  5. Simulate an EU visitor: DevTools → Network request blocking → block get.geojs.io (a failed geo lookup is treated as restricted). Clear site data and reload: consentState is 2.
  6. Click Accept cookies: consentState becomes 1.
  7. Clear site data and reload, then Settings → uncheck Analytics → Save settings: consentState becomes 3.
  8. Reload: consentState is 3 right away, because the stored choice is passed to VWO before the snippet runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear

linear Bot commented Oct 12, 2026

Copy link
Copy Markdown

GRO-1076

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Commit efd5aff is live at https://docs-pr-1379-metaboat.vercel.app

Project Deployment Actions Updated (UTC)
docs 🟢 Ready Preview Oct 12, 2026 10:29am

Deployed to Vercel via GitHub Actions

@tmashara
tmashara marked this pull request as ready for review October 12, 2026 10:30
@tmashara
tmashara requested a review from a team October 12, 2026 10:31
@losrebellos
losrebellos requested a lite review from Copilot October 12, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Standalone HTML docs still bypass VWO, and site-wide body hiding can temporarily blank pages when VWO is slow.

2 open findings
What changed in this PR

This PR aims to make docs visits available as VWO goals and pass analytics consent to VWO.

Changes:

  • Loads the VWO snippet without the previous page-level condition.
  • Initializes VWO from stored consent and updates it when a visitor makes a choice.
File Description
public/​docs/​js/​cookie-consent.js Sends analytics consent changes to VWO.
_includes/​marketing-vwo.html Loads VWO and sets its initial consent state.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@@ -1,4 +1,28 @@
{% if page.vwo or include.force_enabled %}
<script type="text/javascript" id="vwoConsent">
@@ -1,4 +1,28 @@
{% if page.vwo or include.force_enabled %}
<script type="text/javascript" id="vwoConsent">
iethree
iethree previously approved these changes Oct 12, 2026

@losrebellos losrebellos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Agree with Copilot regarding hide_element='body', it should be "" or a narrow selector
  • VWO should be available on production only, like other tracking, etc. libs we're using. WDYT?

@iethree

iethree commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Is there a way we can get vwo tracking behavior on every page while keeping the render-delaying behavior only on pages we're a/b testing?

@iethree
iethree dismissed their stale review October 12, 2026 23:03

Ben is right!

This branch has not been deployed

No deployments
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.

4 participants