Your site's traffic in the macOS menu bar, from DataFast: who is on the site right now, and how today is going.
🚀 1·8
One person online now, eight visitors today. Click it for the rest:
just-launch.dev — 1 online now, 8 visitors today
DataFast dashboard
Open just-launch.dev
──────────────────────────────────────────────
Today, Sep 21
Visitors 8 ▲ +3 vs yesterday at this hour (5)
Pageviews 24 (3.0 per visitor)
Sessions 18 78% bounce
Revenue $0 0 payments
By hour ········█▆█▃
00h to 11h
──────────────────────────────────────────────
Sources today
Direct/None 7
X 1
LinkedIn 1
Pages today
/ 7
/excuses 3
Goals today
signup_started 2
──────────────────────────────────────────────
Yesterday: 7 visitors · Last 7 days: 81 visitors, 338 pageviews
Updated 11:18
The comparison is against yesterday at the same hour, not yesterday's total. At 10am, knowing you are ahead of where you were at 10am yesterday tells you something; yesterday's final number does not.
-
Get xbar (
brew install --cask xbar). -
Drop
datafast.1m.pyinto~/Library/Application Support/xbar/plugins/and make it executable:curl -o ~/Library/Application\ Support/xbar/plugins/datafast.1m.py \ https://raw.githubusercontent.com/nemone81/xbar-datafast/main/datafast.1m.py chmod +x ~/Library/Application\ Support/xbar/plugins/datafast.1m.py
-
In DataFast, open Website settings → Developer and create a website API key (
df_…). It is scoped to that one site, which is all this plugin needs. -
In xbar, open Preferences → Plugin settings and paste the key into
VAR_API_KEY.
That is the whole setup. The site name, its timezone and the dashboard link are read from DataFast, because the key already knows which website it belongs to.
Python 3 is the only dependency, and macOS ships with it.
| Variable | Default | What it does |
|---|---|---|
VAR_API_KEY |
— | The DataFast website API key (df_…). |
VAR_KEYCHAIN_ACCOUNT |
— | Read the key from the keychain instead (see below). |
VAR_SITE_NAME |
the site's domain | Name shown in the menu. |
VAR_TIMEZONE |
the website's timezone | Which day counts as "today". |
VAR_TOP_N |
5 | How many sources, pages and goals to list. |
xbar stores plugin variables in a datafast.1m.py.vars.json file sitting next to the
plugin, in the clear. If you would rather not leave an API key there, put it in the
macOS keychain and point the plugin at it:
# asks for the key twice, and never puts it in your shell history
security add-generic-password -U -A -s xbar-datafast -a mysite -wThen set VAR_KEYCHAIN_ACCOUNT to mysite and leave VAR_API_KEY empty. With no
account set, the plugin looks for one named after the plugin file (datafast).
Copy the plugin under another name — blog.1m.py, shop.1m.py — and each copy gets
its own settings in xbar, and its own keychain account by default. The refresh rate is
the middle part of the file name: datafast.30s.py refreshes every 30 seconds.
Settings can also live in ~/.config/xbar-datafast/<plugin name>.json
(label, site_url, dashboard_url, timezone, top_n, keychain_account), which
is handy when you install the plugin from a dotfiles repo.
Everything comes from the DataFast API: analytics/realtime
for who is on the site now, analytics/overview and analytics/timeseries for today,
plus referrers, pages and goals for the lists.
Responses are cached on disk in ~/Library/Caches/xbar-datafast. Every minute only the
live count and today's totals go over the network; the lists and the comparisons
refresh every ten minutes. If the network or the API fails, the title becomes 🚀 ⚠️
with the error in the dropdown — the menu bar never goes blank.
One quirk worth knowing: /analytics/pages treats endAt as exclusive, unlike
overview and referrers, so the plugin asks it for tomorrow's date to get today.
MIT © Fabio Crestoni