Plausible analytics data into Home Assistant
Requirements:
- Home Assistant
- Plausible (self hosted)
Info: I'm not affiliated to Plausible in anyway! I'm sharing this to give something back to the community. I'm not an expert in HA or Plausible so if you want to improve or add something, I'd love to hear from you!
In short what this software is and does: An alternative to Google Analytics but works without cookies and it's opensource. See their website here: https://plausible.io I'm using it in a docker image (fully self hosted). It could work differently if you use Plausible cloud, so to know if it works the same way, you can find out for yourself.
Features:
- Retrieve the amount of (unique) visitors, pageviews, bounce rate, visit duration etc. from your website(s). Usecases for HA: not only create beautiful graphs, but also create alert notifications when you reach a certain amount of visitors (milestone) or when it’s declining. Or send data to Grafana (or Google sheets) easily so you can store data for a longer period.
- Perform api checks to see whether the Plausible api/app, clickhouse and database (postgres) are running as expected.
Steps to do:
- Open Plausible, settings and create a new API key.
- Create a new HA input_text helper and store the API key there. (you could also create a secret instead)
- Change the resource (2x) to your own IP address (or domain name) where you host Plausible.
- Change siteid to your own website domain name.
- It's now set to 'period=day' but you can change it to something else if you want: see the available options here.
Have fun!
- More info about the API: https://plausible.io/docs/stats-api
- The related topic on HA community: https://community.home-assistant.io/t/plausible-data-into-ha-website-analytics/732653