> ## Documentation Index
> Fetch the complete documentation index at: https://tinyanalytics.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Docusaurus Analytics Integration

> Add tinyanalytics to the scripts array in docusaurus.config.js so every docs page and client-side route change is tracked.

To add tinyanalytics to a **Docusaurus** site, add the tracking script to the `scripts` array in `docusaurus.config.js`. Docusaurus injects it into every page, and client-side navigation between docs pages is tracked automatically.

## Before you start

* A tinyanalytics site. If you don't have one yet, follow the [Quickstart](/docs/tinyanalytics-quickstart).
* Your site's numeric **site ID**, from **Settings → Tracking** in your dashboard.

## Add the script in `docusaurus.config.js`

Add an entry to the top-level `scripts` array:

```js docusaurus.config.js theme={null}
export default {
  title: "My Site",
  scripts: [
    {
      src: "https://dash.tinyanalytics.io/script.js",
      defer: true,
      "data-site-id": "YOUR_SITE_ID",
    },
  ],
  // ...rest of your config
};
```

<Tip>
  Replace `YOUR_SITE_ID` with your real site ID. If you've toggled options in **Settings → Tracking**, add each one as another `"data-..."` key in the same object.
</Tip>

## Client-side navigation is tracked automatically

Docusaurus is a single-page app that renders navigation on the client, and tinyanalytics records each page change as a new pageview by default (`data-track-spa`). See [Track single-page apps](/docs/configure-tinyanalytics-tracking-script#track-single-page-apps) to change this.

## Verify

Build or deploy your site, open it in a browser, then check **Realtime** in your dashboard for your visit. See [Verify your setup](/docs/verify-tinyanalytics-installation) for the full check.

<Check>
  Your install is working when your own visit appears in **Realtime** in your dashboard.
</Check>

## Related

<Columns cols={2}>
  <Card title="Install on VitePress" icon="code" href="/docs/integrations/vitepress-analytics">
    Another docs framework.
  </Card>

  <Card title="Configure the tracking script" icon="sliders" href="/docs/configure-tinyanalytics-tracking-script">
    Every `data-*` option you can set.
  </Card>

  <Card title="Track custom events" icon="hand-pointer" href="/docs/custom-event-tracking">
    Measure clicks and downloads.
  </Card>

  <Card title="Verify your setup" icon="circle-check" href="/docs/verify-tinyanalytics-installation">
    Confirm tracking works.
  </Card>
</Columns>


## Related topics

- [VitePress Analytics Integration](/docs/integrations/vitepress-analytics.md)
- [Angular Analytics Integration](/docs/integrations/angular-analytics.md)
- [Gatsby Analytics Integration](/docs/integrations/gatsby-analytics.md)
