Skip to main content

Docusaurus Integration

Add Ovyxa analytics to your Docusaurus documentation site using the headTags configuration or a custom client module.

In your docusaurus.config.js, add the script to the headTags array:

docusaurus.config.js
module.exports = {
// ... other config
headTags: [
{
tagName: 'script',
attributes: {
defer: 'true',
'data-domain': 'yourdomain.com',
src: 'https://ovyxa.com/js/script.js',
},
},
],
}

Option 2: Using scripts Config

Alternatively, use the scripts array in your config:

docusaurus.config.js
module.exports = {
// ... other config
scripts: [
{
src: 'https://ovyxa.com/js/script.js',
defer: true,
'data-domain': 'yourdomain.com',
},
],
}

Tracking Custom Events

Create a custom client module to track documentation-specific events:

src/ovyxa.js
export function onRouteDidUpdate({ location }) {
// Track search usage
if (location.pathname === '/search') {
window.ovyxa?.('event', 'DocsSearch', {
props: { query: new URLSearchParams(location.search).get('q') },
})
}
}

Register it in your config:

docusaurus.config.js
module.exports = {
clientModules: ['./src/ovyxa.js'],
}

Or trigger events directly from any component:

window.ovyxa('event', 'FeedbackSubmit', { props: { page: '/docs/intro' } })

Cookieless Mode

Add data-cookieless to avoid cookie consent requirements:

docusaurus.config.js
headTags: [
{
tagName: 'script',
attributes: {
defer: 'true',
'data-domain': 'yourdomain.com',
'data-cookieless': 'true',
src: 'https://ovyxa.com/js/script.js',
},
},
],

Verify Installation

  1. Build and serve your site (npm run build && npm run serve)
  2. Visit the local or deployed site
  3. Open the browser Network tab and look for a request to ovyxa.com/js/script.js
  4. Check your Ovyxa dashboard to confirm pageviews are appearing

Next Steps