Skip to content

Commit c7b1f33

Browse files
committed
feat: add Vercel Web Analytics to docs site
The docs are served from checklyhq.com/docs via a Vercel rewrite to Mintlify, so the marketing site's <Analytics /> component never runs on these pages — Vercel proxies Mintlify's HTML and our React tree is never involved. Since docs share an origin with the marketing site, the insights script already served at /_vercel/insights/script.js loads and beacons back to /_vercel/insights/view with correct attribution. Mintlify has no Vercel analytics integration, so this goes in via a custom script. The absolute path matters: /docs/_vercel/insights/script.js 404s, only the root path resolves. Verified against production: initial pageview fires, and client-side sidebar navigation registers as a distinct path rather than collapsing into the entry page (the script patches history.pushState and listens for popstate).
1 parent 9741c73 commit c7b1f33

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

docs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
},
2323
{
2424
"src": "/unify-tracking.js"
25+
},
26+
{
27+
"src": "/vercel-analytics.js"
2528
}
2629
],
2730
"integrations": {

vercel-analytics.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Vercel Web Analytics
2+
// These docs are served under checklyhq.com/docs via a Vercel rewrite, so the
3+
// insights script and its beacon only resolve at the domain root. A path
4+
// relative to /docs 404s.
5+
(function () {
6+
if (window.__vercelInsightsAdded) return;
7+
window.__vercelInsightsAdded = true;
8+
9+
var script = document.createElement('script');
10+
script.src = '/_vercel/insights/script.js';
11+
document.head.appendChild(script);
12+
})();

0 commit comments

Comments
 (0)