DEV Community

Niklas
Niklas

Posted on • Originally published at niklasmtj.de

Simple Analytics iOS widget with Scriptable app

example widget picture

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

  1. Load the scriptable app for your device
  2. 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
  3. Try to run the script and see if everything works.
  4. Go back to your home screen and trigger the "jiggle-mode"
  5. Now add scriptable and choose your newly created script as the script to run
  6. Have fun with your Simple Analytics iOS widget

The GitHub repository can be found here.

Thank you for reading,
Niklas


This post and more you can find on niklasmtj.de

Top comments (0)