Plausible Analytics smart home integration, free and open source

Visitors right now and today's visits of your Plausible sites in Gladys, with a scene on a spike.
Plausible Analytics is a simple, privacy-friendly web analytics tool, open source (AGPL), on plausible.io or self-hosted (Community Edition). This integration brings the figures of your Plausible sites into Gladys: each site becomes a device with its visitors right now and its visitors, visits, page views, bounce rate, visit duration and most viewed page of the day. Scenes can react to a visitor spike, to the first visitor of the day, or to a site that receives no visit any more (a broken tracking script), a dashboard widget shows the day at a glance, and a scene action puts the figures of a site in a message.
Tested against a real self-hosted Plausible Community Edition 3.2.1 (Docker, PostgreSQL and ClickHouse); not yet on plausible.io: feedback welcome on the issues.
What you need
- Gladys Assistant 5.1.0 or later.
- A Plausible: on plausible.io, or your own server (Community Edition 2.1 or later, the first with the Stats API v2), reachable from the Gladys machine.
- A Stats API key of your Plausible account.
- The domains of the sites to follow, as written in Plausible (for example
blog.example.org): a Stats API key cannot list its sites.
At each read the integration sends one request per site (the visitors right now). Every 15 minutes it also reads the figures of the day and the most viewed page (two requests per site), and, when nobody is on a site, the visits of the last hours. plausible.io accepts 600 requests per hour and key: there, the integration stretches the interval by itself to stay under 540 (with 20 sites, one read every 4 minutes). The Community Edition has no such limit.
Getting started
1. Create a Stats API key
In Plausible, open Settings → API keys (your account settings), click New API key, choose the Stats API type, and copy the key (it is shown only once).
2. Configure the integration
In Gladys, open Integrations → Plausible Analytics → Configuration:
- Plausible address: empty for plausible.io, or the address of your server
(for example
http://192.168.1.10:8000). An address copied from the browser is understood. - API key: the Stats API key.
- Domains of the sites: separated by commas, 25 at most.
- Visitors right now: interval: 1, 2 or 5 minutes (1 minute by default).
- Visitor spike from: the visitors at the same time that fire the "Visitor spike" trigger (10 by default).
- No visit for (hours): the hours without any visit that fire the "No visit for a while" trigger (24 by default).
- Language of the names: language of the feature names and of the scene results (French by default).
Save, then click Test the connection: the result gives the number of sites, the visitors of the day and the visitors right now, and the domains Plausible refuses to the key, if any.
3. Add the sites
Open the Discover tab: each site is proposed under its domain. Add the ones you want to see in Gladys. The scene triggers and the widget work for every site, added or not.
The devices
Each site becomes a device with:
- Visitors right now: the visitors of the last 5 minutes, as in the "current visitors" of Plausible.
- Visitors today: unique visitors since midnight.
- Visits today: visits (sessions) since midnight.
- Page views today: page views since midnight.
- Bounce rate today: the share of visits that saw a single page, in percent.
- Visit duration today: the average visit duration, in seconds.
- Most viewed page today: its path, for example
/posts/hello; "-" before the first page view of the day.
"Today" is the day of the site in Plausible, in the time zone set in its settings: the daily figures go back to 0 at its midnight. The visitors right now follow the interval of the configuration, the figures of the day are read every 15 minutes, and at once when a first visitor shows up. A value that does not change is sent again every 12 hours, so Gladys keeps it recent.
Dashboard
The Plausible today widget shows four tiles (visitors right now, visitors, visits and page views of the day), added up over the sites shown, then one row per site with its visitors of the day and right now, the busiest first. With a single site, the most viewed page of the day is shown instead. In the widget settings, choose some sites to show only them (devices added to Gladys). The Refresh button reads Plausible again.
Scenes
Triggers
- Visitor spike: the visitors right now of a site reach the threshold of the configuration. Once per spike, and 30 minutes at least between two announcements for a site: a spike still under way at the end of the pause is announced then. Variables: domain, visitors right now, threshold.
- First visitor of the day: a site receives its first visitor since its midnight. Variables: domain, visitors today. A first visitor that arrived unseen (integration stopped, Plausible unreachable or the domain refused for more than about 15 minutes) is not announced.
- No visit for a while: a site that had visits receives none for the hours of the configuration: the tracking script may be broken, or the site down. Once, until a visit comes again. Variables: domain, hours without a visit.
Each trigger can be limited to some sites (empty: any). What the triggers
remember is kept in the /data volume: a restart of Gladys or of the
integration does not announce a spike or a first visitor twice. Nothing is
announced at the first read of a site: a spike or a silence already under way
is only recorded.
Actions
- Read the figures of a site: gives the domain (
name), the visitors right now (active), thevisitors,visits,pageviews,bounce_rateandvisit_durationof the day, thetop_page, and a ready-madesentence, for example "blog.example.org: 132 visitor(s) and 410 page view(s) today, 4 right now, most viewed page /posts/hello.".
Scene ideas
- When Visitor spike fires for your shop, send a Telegram message "Rush on {{domain}}: {{visitors}} visitors right now".
- When No visit for a while fires, send a notification "No visit on {{domain}} for {{hours}} h: check the tracking script".
- Every evening at 21:00, Read the figures of a site and send the
sentenceby message. - With the device feature Visitors right now as a scene condition, light a lamp in green while someone is on the site.
Troubleshooting
- "Paste a Stats API key": the key is empty.
- "Enter the domains of your sites": no domain could be read; write them as in Plausible, separated by commas.
- "API key refused, or no domain known to Plausible": Plausible answers the same way to a wrong key and to a site the key cannot see. Copy the key again (type Stats API), and check the domains. If only some domains are refused, the others are read, and Test the connection names the refused ones.
- "no Plausible Stats API at this address": check the address and the port (8000 by default), and the version (Community Edition 2.1 or later).
- "the address redirects": enter the
https://address directly. - "too many requests": choose a longer interval, or follow fewer sites.
- The logs of the integration (Integrations → Plausible Analytics) say more; nothing is written there during a normal reading cycle.
Limits
- Read-only: the integration does not change anything in Plausible.
- The domains are typed by hand: a Stats API key cannot list the sites (the Sites API is not in the Community Edition, and an Enterprise feature on plausible.io). A site renamed in Plausible must be renamed in the configuration, and becomes a new device.
- "Visitors right now" is the 5-minute window of Plausible; the figures of the day are at most 15 minutes old, except at the first visitor.
- One Plausible account (plausible.io or a server) per integration, 25 sites at most.
- The thresholds of "Visitor spike" and "No visit for a while" are the same for every site.
- Not tested on plausible.io yet, and not affiliated with Plausible Insights OÜ.
Configuration settings
These are the settings Plausible Analytics asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Your Plausible account | section | No | plausible.io: leave the address empty. Your own server (Community Edition 2.1+): its address. Then a Stats API key (Settings → API keys) and the domains of your sites, as in Plausible. Then add the sites from the Discover tab. |
| Plausible address | string | No | Empty for plausible.io, or the address of your own server. |
| API key | secret | Yes | A key of type "Stats API": Settings → API keys in Plausible. |
| Domains of the sites | string | Yes | As written in Plausible, separated by commas (25 at most). |
| Options | section | No | |
| Visitors right now: interval | select | No | One request per site each time; the figures of the day every 15 minutes. plausible.io: stretched to stay under 600 requests per hour. |
| Visitor spike from | number | No | Visitors at the same time (last 5 minutes) that fire the scene trigger "Visitor spike". |
| No visit for (hours) | number | No | Hours without any visit that fire the scene trigger "No visit for a while". |
| Language of the names | select | No | Language of the feature names (set when a device is added) and of the scene results. |
How to install Plausible Analytics in Gladys
- In Gladys, open Integrations: Plausible Analytics appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/guim31/gladys-plausible:1.0.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/guim31/gladys-plausible.
Plausible Analytics requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Plausible Analytics is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation