timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.45k stars 1.96k forks source link

Support for Self Hosted Plausible #965

Closed EmilMoe closed 1 month ago

EmilMoe commented 1 month ago

Is your feature request related to a problem? Please describe. I'm hosting my own Plausible server, I don't see how I can integrate that?

Describe the solution you'd like An optional parameter with domain

Describe alternatives you've considered I tried to update my config to this, but that didn't seem to work

plausibleAnalytics: {
  plausibleDataDomain: '<domain in plausible>', // e.g. tailwind-nextjs-starter-blog.vercel.app
  plausibleSrc: 'https://<my domain>/js/script.js',
},
colkito commented 1 month ago

I think it depends on the pliny module. Have you tried by setting the dataApi prop? https://github.com/timlrx/pliny/blob/b91eb82057989d428496cf8e94accf70564b175b/packages/pliny/src/analytics/Plausible.tsx#L5 Its possible to proxy the domain: https://github.com/timlrx/pliny/blob/b91eb82057989d428496cf8e94accf70564b175b/packages/pliny/src/analytics/Plausible.tsx#L11

EmilMoe commented 1 month ago

I think it depends on the pliny module. Have you tried by setting the dataApi prop? https://github.com/timlrx/pliny/blob/b91eb82057989d428496cf8e94accf70564b175b/packages/pliny/src/analytics/Plausible.tsx#L5 Its possible to proxy the domain: https://github.com/timlrx/pliny/blob/b91eb82057989d428496cf8e94accf70564b175b/packages/pliny/src/analytics/Plausible.tsx#L11

Thanks, it even seems to be this simple:

plausibleAnalytics: {
  plausibleDataDomain: '<domain in plausible>', // e.g. tailwind-nextjs-starter-blog.vercel.app
  src: 'https://<my domain>/js/script.js',
},