Skip to content

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Oct 9, 2025

This is to have a simple built-in support for a plausible-analytics key, like we have for google-analytics.

I say simple because what this does it only accepting the HTML snippet that a user is supposed to get from its plausible dashboard: https://plausible.io/docs/plausible-script

website:
  title: "Plausible Custom Script Test"
  plausible-analytics: |
    <script async src="https://plausible.io/js/pa-TESTCODE123.js"></script>
    <script>
      window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)};
      plausible.init()
    </script>

It seems there are ways to use a generic https://plausible.io/js/script.js and pass domain as attributes. However, this is not documented and could be harder to maintain.
Also the user workflow will always be to go to its plausible dashboard to activate, and so copy pasting the snippet is easy enough.

More complex config would allow something like google-analytics

website:
  plausible-analytics:
    domain: example.com
    ... 

but again, not well documented and so probably not easy to maintain and test.

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Oct 9, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cwickham
Copy link
Collaborator

cwickham commented Oct 9, 2025

I like this balance: a dedicated key gives us an obvious place to document it (alongside google-analytics), while relying on a copy-paste reduces the maintenance burden.

@cderv
Copy link
Collaborator Author

cderv commented Oct 10, 2025

Great!

I'll make a PR to the doc too.

@cderv
Copy link
Collaborator Author

cderv commented Oct 10, 2025

We could also do this to allow less ugly configuration

plausible-analytics: 
  path: _plausible.html

in addition of

website:
  plausible-analytics: |
    <script async src="https://plausible.io/js/pa-XXXXXX.js"></script>
    <script>
      window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};
      plausible.init()
    </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants