Plausible Analytics iOS Widget for Self-hosted Websites

Here’s a script to create your own Plausible Analytics iOS widget for self-hosted websites. It’s a simple and intuitive way to keep track of your website’s daily performance on the go. With this 1:1 block widget (see screenshot for reference), you can access key daily metrics directly from your iPhone or iPad’s home or lock screens, such as real-time data, page views, unique visitors, top referrer, and top country. 

Purchase the code snippet from verfasor.com digital store

IMPORTANT

① According to the instructions (see below), example.com = your primary domain and analytics.example.com = the subdomain where you’ve installed Plausible. You’ve to replace both accordingly.

② The widget size is 1×1. That’s a small, square size widget.

③ It is only tested on self-hosted Plausible instances.

How to create the Plausible Analytics iOS widget:

Step 1: Generate an API key from https://analytics.example.com/settings.

Step 2: Install Scriptable on your iPhone/iPad. Scriptable is a free automation tool that enables you to write scripts that integrate with the native features of iOS/iPadOS.

Step 3: Get plausible-analytics-widget.js. The script contains helper texts as comments. Paste the content of the script to scriptable, and start editing. Alternatively, paste the script to a code editor on your PC/macOS, make the edits, and send the final version to your iPhone/iPad.

Step 4: Edit the plausible-analytics-widget.js

① In line 6, add your baseURL, https://analytics.example.com/api/v1/stats/. 

② In line 9, add your API key.

③ In line 12, add your siteID, which is example.com.

④ In line 114, replace “Example Daily” with your brand or domain name.

⑤ In line 120, add a URL to visit after tapping on the widget.

Step 5: Add the final version of the script to scriptable, and set it as the home-screen or lock-screen Plausible Analytics widget in iOS.

If you need further assistance, reach out to [email protected] I also make Python scripts for Plausible. If you need a hook for a specific app, I can help.

Email [email protected] or wechat: mighil to work together. I can help you with content, product ops, scripting, strategy, and technology.

Random: something I've read, browsed, or watched.

*Previously Jotzilla.net. Powered by DigitalOcean, GeneratePress, and BunnyCDN.