Traffic Analytics Service - A web analytics proxy for Ghost that processes and enriches traffic data before forwarding it to Tinybird's analytics API.
- User agent parsing for OS, browser, and device detection
- Referrer URL parsing and categorization
- Privacy-preserving user signatures with daily-rotating salts
- Configurable salt storage (in-memory or Firestore)
- Docker-first development with Firestore emulator support
Copy .env.example
to .env
and configure as needed:
# Salt Store Configuration
SALT_STORE_TYPE=memory # Options: memory, firestore
# Firestore Configuration (when SALT_STORE_TYPE=firestore)
FIRESTORE_PROJECT_ID=traffic-analytics-dev
git clone
this repo &cd
into it as usual- Run
yarn
to install top-level dependencies.
yarn build
to transpile Typescript to JSdocker compose build
oryarn docker:build
to build docker image
yarn dev
start development server locallydocker compose up
oryarn docker:dev
start development server in docker compose (includes Firestore emulator)- View: http://localhost:3000
Sometimes it's useful to test the full setup with Ghost pointing its tracker script to this analytics service running locally. This can be acheived relatively easily with Docker Compose:
- Set the
tinybird:tracker:endpoint
tohttp://localhost/.ghost/analytics/tb/web_analytics
in your Ghost config - Run
docker compose --profile=split up
in your Ghost clone - If you want to test the full e2e flow to Tinybird, set the
PROXY_TARGET=https://api.tinybird.co/v0/events
value in your.env
file in this repo. Otherwise the analytics service will use the/local-proxy
mock endpoint, which does not forward events to Tinybird. - Run
yarn docker:dev:ghost
in the root of this repo - Visit your Ghost site's homepage at
http://localhost
and you should see a successful request in the network tab.
yarn test
run all tests locallydocker compose run --rm test
oryarn docker:test
run all tests in docker compose
yarn lint
run eslint locallydocker compose run --rm lint
oryarn docker:lint
run eslint in docker compose
Copyright (c) 2013-2025 Ghost Foundation - Released under the MIT license.