hugo-coder icon indicating copy to clipboard operation
hugo-coder copied to clipboard

Working with Plausible Analytics

Open realchandan opened this issue 1 year ago • 1 comments

Hello,

I recently tried integrating my self-hosted Plausible instance with my site, but I faced issues with the CSP.

I finally got it working, but I spent a few hours experimenting with another Hugo module and changing the server's response headers.

I didn't know much about CSP before. It would be helpful and time-saving if you could update the Plausible Analytics Guide to include that, in case of self-hosting, we also need to add the Plausible domain to connect-src and script-src.

connectsrc = [
  "'self'",
  "https://plausible.example.com",
]
scriptsrc = [
  "'self'",
  "'unsafe-inline'",
  "https://plausible.example.com",
]

image

It might not be obvious to everyone, but now that I know, I will be more careful. And thank you for this amazing theme!

realchandan avatar Dec 27 '23 10:12 realchandan

Sure. We need to mention that using CSP is not necessary too. It's a choice.

I'm going to flag this issue, asking for contributions. Anyone could add an entry in the docs folder about it.

luizdepra avatar Jan 18 '24 00:01 luizdepra