Simple Analytics iOS widget with Scriptable app
2 min read
278 words
Today I quickly build an iOS widget to see my page views and visitors on my iPhone. Since I don't always want to start my laptop to see my current website stats in Simple Analytics I created this widget based on an example widget I found in the Scriptable app. The great thing about Scriptable is that uses the JavaScript Core of iOS. This means that a lot of features of ES6 are available to use. You can find a documentation in the Scriptable app or at docs.scriptable.app.
Since it would be very tedious to write code on the small touchscreen, I wrote the code on my laptop and then pasted it on my phone.
Without further ado here are the installation steps.
How to install
- Load the scriptable app for your device
- Copy the content of the getSimpleAnalyticsStats.js file on GitHub and fill in the first 3 lines of the file with your apiKey, userId and the domain you want to track. You can get your keys in your account settings https://simpleanalytics.com/account
- Try to run the script and see if everything works.
- Go back to your home screen and trigger the "jiggle-mode"
- Now add scriptable and choose your newly created script as the script to run
- Have fun with your Simple Analytics iOS widget
The GitHub repository can be found here.
Thank you for reading,
Niklas