DataSag guides · Updated 27 October 2026
Fix DataSag analytics not working on Docusaurus
Find the first missing step in the delivery chain: published HTML, executing tracker, tracking request, successful response and project report. Changing several settings at once makes the failure harder to identify. This guide applies to Docusaurus.
Start with the Docusaurus installation
Add an object to the existing Docusaurus scripts array with src, defer and data-datasag-key attributes. Preserve the rest of your configuration. Build and serve the generated production site, then test a documentation route directly and through client navigation. The config runs in Node.js, so browser event calls do not belong there.
Docusaurus accepts string script entries, but an object is needed here to preserve the public tracking-key attribute and explicit non-blocking loading. Do not also insert the tracker through a client module, swizzled theme component or individual MDX page.
Use the public project key from the DataSag project you are inspecting. A test on a preview domain does not confirm that the production domain has the same code or settings.
Fix DataSag analytics not working in Docusaurus
- Confirm the deployed build used the edited docusaurus.config file and not another documentation package in a monorepo. Inspect the generated HTML for the script object's src and data-datasag-key attributes before debugging React code.
- Check whether the failure affects one version, locale or plugin route. Compare its published document with a working route. A tracking example placed in one MDX file does not establish a global installation.
- If only a custom action is missing, inspect the browser component that owns it. The config is evaluated in Node.js and cannot call window.datasag. Test its client handler after the external script has executed.
The failed boundary is identified as build selection, generated route coverage or browser-only interaction code.
Complete the collection checks
- Confirm the change reached the public domain. Inspect the live HTML and clear only caches that serve the old document. A saved editor change may still need publishing.
- Check that tracker.js exists in the Network panel and that the script contains the public key from the same DataSag project you are viewing.
- Check whether your test browser is excluded with datasag_ignore. Restore inclusion with ?datasag_ignore=false only if this browser should count. Respect any consent controls configured on your site.
- Inspect the browser Console for Content Security Policy or script errors. Check /api/track request responses: 400 indicates invalid input, 404 can indicate an unknown project key, and a server failure needs investigation rather than repeated snippet changes.
- Try a controlled browser profile to identify an extension block. Do not bypass a visitor's privacy preferences. Then check the project's selected date range, path and domain.
- Collect the affected public URL, approximate time, request status and installation location for support. Omit account credentials and visitor data from screenshots.
typeof window.datasag?.track
// If undefined, first investigate whether the script executed.
new URL(location.href).searchParams.get('datasag_ignore')
// Also check for a previously saved browser exclusion.What a successful check looks like
The first failed boundary is identified and corrected, and a new controlled visit reaches the right project. The browser Console and Network panel provide the evidence.
Record the public path you tested, the browser state, the approximate time and the observed request. Check one direct page load and one later navigation so the result covers more than the homepage.
Common mistake
Do not replace the public project key with a Supabase, Stripe or provider secret. The browser snippet uses only the project's public tracking key.
Installation snippet for Docusaurus
The shared installation belongs in the scripts array in docusaurus.config.js or docusaurus.config.ts. Use this as the installation reference while checking the procedure above.
// Merge this entry into the existing scripts array.
export default {
scripts: [{
src: "https://www.datasag.com/tracker.js",
defer: true,
"data-datasag-key": "YOUR_PUBLIC_KEY"
}]
};Related Docusaurus guides
References
Official Docusaurus documentation covers the integration point. For DataSag data handling, read the privacy policy. Use support if a request fails after these checks.