Skip to content
Frameworks

Docusaurus analytics for documentation sites

2 min read · Updated · By the Reveata team

Short answerAdd the Reveata script to the scripts array in docusaurus.config.js, or build the entry with @reveata/next/snippet. Page changes inside the docs are tracked by the script, so every page a reader opens is counted.

Documentation is often where developers decide whether to buy. Reveata on your Docusaurus site shows which pages they read, where they came from, including AI assistants and search engines, and, when your docs and product share a visitor, which docs pages lead to paying customers.

What you get

  • Every docs page counted, including in-site navigation.
  • Sources of readers: search engines, AI assistants, GitHub, forums and tagged links.
  • Scroll depth and outbound clicks by default, so you can see whether readers reach the end of a guide and which links they follow out.
  • One visitor across docs and product when they share a root domain, or across domains with data-domains.

How to install it

Add the script to docusaurus.config.js:

js
// docusaurus.config.js
export default {
  scripts: [
    {
      src: 'https://reveata.com/js/script.js',
      defer: true,
      'data-website-id': 'ws_your_tracking_id',
    },
  ],
};

Or build the same entry with docusaurusScript({ websiteId, host }) from @reveata/next/snippet (npm install @reveata/next). The scripts option is described in the Docusaurus config reference (opens in a new tab). Build and deploy.

Connecting docs reading to revenue

A docs site rarely takes payments itself. To see which pages lead to customers, track the docs and your product in one Reveata website:

Setup What to do
docs.example.com and app.example.com Same root domain: one website covers both (subdomains)
example.dev docs and example.com app List both in data-domains so links carry the visitor (cross-domain tracking)

Then connect your payment provider in the product, and a buyer's earlier docs visits become part of their journey. Under first-touch attribution, a docs page that first brought a buyer gets the credit (revenue attribution).

Goals for docs

Count a click on "Get started" or "Sign up" with data-reveata-goal="signup" on the link in an MDX page, or call window.reveata?.('goal', 'copy_install') from a component (custom goals).

Frequently asked questions

Does it count visits to the local dev server?

No. The script ignores localhost by default.

Can I exclude versioned or draft docs?

Yes. Add data-exclude-paths with a wildcard, for example /docs/next/*, or set exclusions in Settings → General → Exclusions.

Do I need a Docusaurus plugin?

No. The built-in scripts option loads the tag on every page, and the script follows page changes itself.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
IntegrationAngular analytics with ReveataPaste the Reveata snippet before the closing head tag of src/index.html. ng build keeps it in the built page, server-side rendering included, and the Angular Router's History API navigation is counted automatically. HashLocationStrategy needs data-hash="true".IntegrationAstro analytics with revenue attributionPaste the Reveata snippet with is:inline into the Astro layout that renders the head of every page. Astro then leaves the tag as written, view transitions are tracked, and payment links or checkouts started from your pages are credited to the visit behind them.IntegrationDjango analytics with revenue attributionPaste the Reveata snippet before the closing head tag of the base template your Django templates extend. Every page is tracked, the Django admin is not, and two hidden form fields let your checkout view put the visitor id into the payment's metadata.IntegrationExpress.js analytics with a first-party proxyPaste the Reveata snippet into the layout, static HTML or front-end index.html your Express app serves. Two Express routes can serve the script from your own domain with your proxy secret, and your checkout route can copy the visitor id into the checkout metadata.IntegrationFastAPI analytics with ReveataPaste the Reveata snippet into the base Jinja2 template of your FastAPI app, or into the index.html of the front end FastAPI serves. Two FastAPI routes can serve the script from your own domain, and your checkout endpoint can put the visitor id into the payment's metadata.IntegrationFlask analytics with ReveataPaste the Reveata snippet into the base Jinja template your Flask pages extend. Every page is tracked, two small Flask routes can serve the script from your own domain, and your checkout route can copy the visitor id into the payment's metadata.