Mintlify
Add Databuddy's privacy-first analytics to your Mintlify documentation site by dropping a small databuddy.js file next to your docs.json. Mintlify auto-loads any .js file in your content directory on every page, so the tracker becomes available across all of your docs with zero per-page wiring.
How to Add Databuddy to Mintlify
Get Your Client ID
Open your Databuddy dashboard, select the website that represents your docs, and copy the Client ID from the tracking setup screen.
Create databuddy.js
In your Mintlify project, create a new file named databuddy.js in the same directory as your docs.json.
(() => {
const script = document.createElement("script");
script.src = "https://cdn.databuddy.cc/databuddy.js";
script.setAttribute("data-client-id", "YOUR_CLIENT_ID");
script.crossOrigin = "anonymous";
script.async = true;
document.head.appendChild(script);
})();Replace YOUR_CLIENT_ID with the Client ID you copied from your dashboard.
Deploy Your Docs
Commit and push the new file to your repository:
git add databuddy.js
git commit -m "feat(docs): add databuddy analytics"
git pushMintlify rebuilds your docs on push and includes any .js file in your content directory on every page automatically. No extra changes to docs.json are required.
Verify Tracking
Open your published Mintlify site, then:
Configuration Options
Enable extra tracking features by adding more data-* attributes when you create the script element.
(() => {
const script = document.createElement("script");
script.src = "https://cdn.databuddy.cc/databuddy.js";
script.setAttribute("data-client-id", "YOUR_CLIENT_ID");
script.setAttribute("data-track-attributes", "true");
script.setAttribute("data-track-outgoing-links", "true");
script.setAttribute("data-track-interactions", "true");
script.setAttribute("data-track-performance", "true");
script.setAttribute("data-track-web-vitals", "true");
script.setAttribute("data-track-errors", "true");
script.crossOrigin = "anonymous";
script.async = true;
document.head.appendChild(script);
})();See the full list of options in the SDK reference.
Custom Event Tracking
Mintlify renders MDX, so you can drop tracked elements directly into any .mdx page.
Using Data Attributes
<button data-track="cta_click" data-button-type="primary">
Get Started
</button>
<a href="/pricing" data-track="pricing_link_click" data-link-location="docs-header">
View Pricing
</a>Programmatic Events
Once the script has loaded, window.databuddy is available globally. You can call it from any inline <script> block in an MDX page or from your own custom script.
if (window.databuddy) {
window.databuddy.track("docs_search", {
query: "getting started",
page_path: window.location.pathname,
});
}Troubleshooting
Related Integrations
Need help with your Mintlify integration? Contact us at help@databuddy.cc.
How is this guide?