Install on Docusaurus
List the tag in the scripts array of docusaurus.config.js and it is added to every documentation page.
Docusaurus can inject third-party scripts from its config, so no theme swizzling is needed.
Where it goes
Add an entry to the scripts array in docusaurus.config.js. Extra keys become attributes on the rendered tag.
module.exports = {
scripts: [
{
src: 'https://statsy.co/js/script.js',
defer: true,
'data-website-id': 'ws_XXXXXXXX',
'data-domain': 'docs.yourstartup.com',
},
],
};Set data-domain to the host the docs are actually served from. Beacons are accepted from your site’s domain and its subdomains, so a docs site on docs.yourstartup.com can report into the same Statsy site as yourstartup.com.
Confirm it works
Build and deploy, then open the docs and check Live. Click through to another page: Docusaurus routes on the client with the History API, so each page is counted.
One Statsy site, or two
You can measure docs in the same site as your marketing pages, or create a separate site for them. Same site means one set of totals and a Pages report that mixes both; separate sites keep the reports clean but split visitor counts. See Subdomains and multiple domains before you choose.
Last updated · Markdown version