All docs

Start

  1. 01Getting started
  2. 02Install
  3. 03Tracking

Features

  1. 04The dashboard
  2. 05Campaigns
  3. 06Goals & Conversions
  4. 07Funnels
  5. 08Short links
  6. 09Custom domains
  7. 10Importing history
  8. 11AI sources and agents
  9. 12Email reports
  10. 13Scheduled check
  11. 14Ask your AI
  12. 15Runlight for Mac

Reference

  1. 16Performance
  2. 17Configuration
  3. 18HTTP API

Platforms

  1. 19Standalone server
  2. 20ClickHouse
  3. 21PHP
  4. 22WordPress
  5. 23Drupal
  6. 24Craft CMS
  7. 25Webflow
  8. 26Python
  9. 27Rails
  10. 28Ruby
  11. 29Go
  12. 30Java
  13. 31.NET
  14. 32Elixir
  15. 33Rust

Trust

  1. 34Privacy

Start

Getting started

Runlight is web analytics that installs into your app. It takes five minutes to get from npm install to your first visit.

Runlight runs inside an app you already have, as a server of its own, or as a plugin in WordPress, Drupal, or Craft CMS. It keeps its numbers in your own database and serves its dashboard from your own domain, so there is no Runlight account to create and your data never passes through a server of ours.

Choose how to run it

Pick the way that fits, copy its line, and follow its guide.

In your app

Runlight runs inside the app that serves your pages, from one route, and keeps its numbers in that app’s database.

npm install @runlight/sdk better-sqlite3

Then create the instance, mount the routes, and add the script, as the steps below show for Next.js. Install has the lines for every other framework.

Read the guide

Its own server

One process with a dashboard of its own, for several sites at once, or for a site that cannot run Runlight itself, such as a Webflow site.

docker run -d --name runlight -p 3000:3000 -v runlight:/data ghcr.io/runlightsh/runlight

It listens on port 3000 and prints a link that makes your account, as Standalone server shows.

Read the guide

A CMS plugin

A plugin runs Runlight inside WordPress, Drupal, or Craft CMS, or sends the site’s visits to a Runlight you run elsewhere.

wp plugin install runlight --activate

Or install it from WordPress.org under Plugins, Add New Plugin in WordPress.

Read the guide

1. Install

These steps set up the TypeScript library in an app that serves routes, such as Next.js, Nuxt, SvelteKit, Astro, Remix, Express, NestJS, Fastify, Koa, Hono, or anything else that handles a web Request, on Node 22 or later, Bun, Deno, or Cloudflare Workers. Every other language has the same steps on its own page.

bash

npm install @runlight/sdk better-sqlite3

better-sqlite3 is the SQLite driver. For Postgres, MySQL, MariaDB, Turso, Cloudflare D1, or Bun’s own SQLite, see Configuration.

2. Create the instance

Create one file and import it wherever you need Runlight.

lib/runlight.ts

import { runlight } from "@runlight/sdk";
import { sqlite } from "@runlight/sdk/sqlite";

export const rl = runlight({
  store: sqlite({ path: "./data/runlight.db" }),
  site: { name: "example.com", hostnames: ["example.com"], timezone: "Europe/London" },
});

The tables are created on first use. The database file is yours, so back it up like any other.

3. Mount the routes

In Next.js (App Router), one catch-all route serves the tracker and the dashboard and receives each visit.

app/runlight/[[...path]]/route.ts

import { rl } from "@/lib/runlight";

export const { GET, POST, PUT, PATCH, DELETE, OPTIONS } = rl.routes();

Other frameworks take one or two lines too, as Install shows.

4. Add the script

Put this on every page, just before </head>.

html

<script defer src="/runlight/s.js"></script>

The script is under 2 KB gzipped and posts to your own domain without setting any cookies.

5. Sign in

The dashboard is private, so set a long random token in your environment.

bash

RUNLIGHT_TOKEN=a-long-random-string

Then open /runlight/?token=a-long-random-string once. Runlight sets a cookie holding a digest of the token (never the token itself) and sends you on to the dashboard.

With no token set, the dashboard is open only while NODE_ENV is development, as it is under next dev. Everywhere else it answers 503 until you set one.

Visit any page of your site and you will see yourself under “here now” within seconds.

6. Schedule the hourly check

Call a check once an hour. It rotates the daily salt, sends email reports, deletes visits a site no longer keeps, and adds up finished days. Scheduled check shows how to set it up. On Vercel it is four lines of vercel.json.

Next

  • Tracking covers custom events, single page apps, clicks with no code, and the settings on the script tag.
  • Campaigns shows which newsletter, post, or ad sent each visit.
  • Goals & Conversions covers conversions and revenue, and Funnels follows visits through several steps.
  • Short links puts links on your own domain and counts them like visits, and Custom domains sets that domain up and loads the script from it.
  • Importing history brings your visits over from Plausible, Umami, or a CSV file.
  • Privacy lists exactly what Runlight stores and what it leaves out.