Mintlify
Add Rybbit analytics to your Mintlify docs
Mintlify includes every .js file in your docs content directory on every page, so the snippet goes into a small JavaScript file that injects the tag.
Get your tracking snippet
In your Rybbit dashboard, open Site Settings → Tracking Script and copy your snippet. It looks like this:
<script src="https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID" defer></script>YOUR_SITE_ID is the numeric ID of your site. If you self-host Rybbit, app.rybbit.io is the domain of your own instance.
Add the snippet to Mintlify
Create a JavaScript file in your content directory, next to docs.json and your .mdx pages:
(function () {
var el = document.createElement("script");
el.src = "https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID";
el.defer = true;
document.head.appendChild(el);
})();Commit and deploy. Mintlify picks the file up automatically; there is nothing to register in docs.json. See Mintlify's custom scripts page for the current rules on file placement.
To pass script attributes such as skip patterns, set them on the element before appending it:
el.setAttribute("data-skip-patterns", JSON.stringify(["/internal/**"]));Mintlify sites are single-page apps. Rybbit records client-side navigation as pageviews, so no extra code is needed.
Verify installation
Open your live site in a new tab and click through a few pages. Within a few seconds the pageviews appear in the Rybbit dashboard.
If nothing shows up:
- View the page source and search for
script.js?siteId=to confirm the snippet is on the page. - Open the browser Network tab and check that
script.jsreturns200and thatPOSTrequests go to/api/track. - Disable ad blockers, or set up a proxy so the script loads from your own domain.
- See the script troubleshooting guide for other common causes.
Track custom events
Mintlify pages are MDX, so you can attach handlers inline:
<button
onClick={() => window.rybbit?.event("download_clicked", { file: "getting-started.pdf" })}
>
Download guide
</button>Next steps
- Track custom events such as signups, purchases and button clicks.
- Identify users to connect sessions to accounts.
- Proxy the script through your own domain to bypass ad blockers.
- Script attributes let you skip or mask URLs and tag events.