Repository navigation
docs: add-plausible - #348
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Plausible analytics tracking to the Docusaurus docs site by injecting Plausible script tags into the HTML <head> via the Docusaurus config.
Changes:
- Add Plausible
<script>tag loading a custom Plausible JS asset. - Add an inline bootstrap snippet to initialize/queue Plausible calls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| headTags: [ | ||
| { | ||
| tagName: "script", | ||
| attributes: { | ||
| async: "true", | ||
| src: "https://plausible.io/js/pa-GXbpwCRHPm1QSDOLNB_on.js", | ||
| }, | ||
| }, | ||
| { | ||
| tagName: "script", | ||
| attributes: {}, | ||
| innerHTML: `window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()`, | ||
| }, | ||
| ], |
There was a problem hiding this comment.
Plausible ignores localhost traffic by default, I don't think we need to add this.
| attributes: { | ||
| async: "true", | ||
| src: "https://plausible.io/js/pa-GXbpwCRHPm1QSDOLNB_on.js", | ||
| }, | ||
| }, | ||
| { | ||
| tagName: "script", | ||
| attributes: {}, | ||
| innerHTML: `window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()`, | ||
| }, |
There was a problem hiding this comment.
Plausible explicitly says to mark as async, so I don't think we should change this.
| { | ||
| tagName: "script", | ||
| attributes: {}, | ||
| innerHTML: `window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()`, | ||
| }, |
There was a problem hiding this comment.
Similarly, this is copied directly from Plausible and I'm hesitant to mess with it. I don't know what the benefit would be.
|
@aboydnw just realized that this doesn't have metrics on the published examples, which are deployed as independent static sites. Not sure if you want to change that? |
I created a new site in plausible and added the custom script here.