How to add the script to your Docusaurus site

There are several simple ways to integrate Plausible Analytics with your Docusaurus documentation site. Let's take a look at them:

Option 1. Inject the script through the docusaurus.config.js

Add this Plausible Analytics snippet into your "docusaurus.config.js" file (make sure to change "yourdomain.com" to the domain name that you added to your Plausible account).

This is how we've integrated Plausible into our very own Docusaurus-powered documentation:

module.exports = {
scripts: [{src: 'https://plausible.io/js/plausible.js', async: true, defer: true, 'data-domain': 'yourdomain.com'}],
};

Option 2: Plausible Analytics community plugin

Now you can go to your website to verify if the Plausible Analytics script has been added and to your Plausible Analytics account to see whether the stats are being tracked.