Skip to content

douwepausma/strapi-plausible

Repository files navigation

Logo - Strapi Plausible plugin

Strapi + Plausible

Add one or more Plausible analytics dashboards to Strapi



A plugin for Strapi that embeds Plausible analytics dashboards. The Strapi Plausible plugin is inspired by it's predecessor created by Devtastic.

Supported Strapi versions

  • Strapi v5 npm i strapi-plausible@2.x.x
  • Strapi v4 yarn add strapi-plausible@1.x.x (or use this plugin by Devtastic, no multi-dashboard support).

Screenshot

Screenshot - Strapi Plausible plugin

Installation

With npm

npm install strapi-plausible

With yarn

yarn add strapi-plausible

In the config/plugins.js file add:

module.exports = ({ env }) => ({
  // ...other plugins
  plausible: {
    config: {
      plausibleInstance: 'https://plausible.io', // or your self-hosted url
      domains: [
        {
          name: 'tracked-site.com', // name of the plausible site
          auth: 'lNU0nKCmnSxs3HjjWOKtX' // auth token
        }
      ]
    }
  }
})

You can create a shared link in Plausible by going to Site settings › Visibility. It looks something like this:

https://plausible.io/share/tracked-site.com?auth=lNU0nKCmnSxs3HjjWOKtX

⚠️ Make sure not to enable password protection for this link

⚠️ If you're using the strapi::security middleware with CSP enabled, make sure to allow plausible.io or your self-hosted instance (e.g. analytics.example.com) as a frame-src. Your config/middlewares.js should look something like:

 {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "frame-src": ["https://plausible.io"],
        ...

📝 License

MIT License

Made in 🇳🇱 by @douwepausma inspired by Devtastic.

About

Add one or more Plausible analytics dashboards to Strapi.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors