Widget

Custom JS

Write a small JavaScript snippet that fetches from any API and returns a value. The script runs on a schedule and its return value is displayed live on your dashboard.

What it is for

Use Custom JS when no built-in widget type covers your data source. Pull from a REST API, scrape a JSON endpoint, compute a derived metric, or chain multiple fetches. Any value you can express in async JavaScript becomes a live widget.

How to add it

  1. Click + Add widget and select Custom JS.
  2. Write your script in the code editor. The script must return (or resolve to) the value you want to display.
  3. Save. The script runs immediately and shows the result.

Configuration

FieldDescription
LabelDisplay name on the widget.
JavaScriptAsync function body. Must return { result, down }. Has access to fetch, URL, and URLSearchParams.

Tips

  • The script runs in a sandboxed Node.js environment with fetch available.
  • Keep scripts under a few seconds; they time out at 10s.
  • Return a plain string or number for scalar display. Return an array of objects to get structured output (table, multi-series charts, stacked bar).

Display options

When your script returns a plain value, all time-series display types are available (text, chart, bars, candlestick, histogram, heatmap). When it returns an array of objects, you also get the table view and multi-series chart modes the full set of options described in Display types. Use the value key selector in display settings to choose which field to chart, and toggle between single-row (multi-key overlay) and all-rows (one series per row) modes.

Credit cost

0.02 credits per check

Text

GitHub stars

18,392

Histogram

Error rate by type

TypeError

TypeError404Timeout500
Custom JS · 7di Docs