Plausible data into HA (website analytics)

Hi, I’ve been working on getting Plausible analytics data into HA. The reasons why I share:

  • It’s time to give something back to the community.
  • I’ve got almost everything in HA, why not the analytics data which I use for my websites.
  • It’s not mentioned anywhere on this forum yet nor an integration exist.
    - 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! (this topic or github page, see below)

I’m not affiliated to Plausible in anyway. In short what it is and does: an alternative to Google Analytics but works without cookies and it’s opensource. I’m using it in a docker image (self hosted). It could work differently if you use their 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:

  1. Open Plausible, settings and create a new API key.
  2. Create a new input_text helper and store the API key there. (you could also create a secret instead)
  3. Change the resource (2x) to your own IP address (or domain name) where you host Plausible.
  4. Change siteid to your own website domain name.
  5. It’s now set to ‘period=day’ but you can change it to something else if you want: see the available options here.

See the code for HA here: GitHub - 1mfaasj/PlausibleToHA
More info about the API: Stats API reference | Plausible docs

have fun!

1 Like