Skip to main content

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/script.js', defer: true, 'data-domain': 'yourdomain.com'}],
};

Option 2: Plausible Analytics community plugin

"A Docusaurus plugin for Plausible Analytics". Built and maintained by Alistair Scott and the Abar Team.

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