Skip to content

Tracking a website

Create a site in the dashboard (Sites → Add site). You’ll get two snippets.

The script is served from Rýni and posts cross-origin:

<script async src="https://ryni.example/ryni.js"
data-ryni-server="https://ryni.example"
data-ryni-site="<tracking_id>"></script>

Set the site’s allowed origins to your website’s origin so the cross-origin request is accepted.

The script and the requests stay on your own origin:

<script async src="/ryni.js" data-ryni-site="<tracking_id>"></script>

You must serve /ryni.js and forward /t/ to Rýni from your own server.

Add data-ryni-detailed to re-fire on route changes:

<script async src="/ryni.js" data-ryni-site="<tracking_id>" data-ryni-detailed></script>

Variant B serves the tracker and the tracking endpoint from your own origin, so adblockers (which block cross-origin analytics) see only same-origin requests. You need two things on your server:

  1. Serve the Rýni tracker script at /ryni.js (copy the built frontend/public/ryni.js into your static assets, or proxy it).
  2. Forward /t/ to your Rýni instance.
# Serve the tracker (either copy the file here, or proxy it):
location = /ryni.js {
proxy_pass https://ryni.example/ryni.js;
proxy_set_header Host ryni.example;
}
# Forward tracking requests to Rýni:
location /t/ {
proxy_pass https://ryni.example/t/;
proxy_set_header Host ryni.example;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

The idea is the same everywhere: add a route that forwards POST /t/<id> to https://ryni.example/t/<id> (preserving the path and query string).

For example, in a SolidJS/Vite app, add a Vite dev proxy:

vite.config.ts
export default {
server: {
proxy: {
'/t/': { target: 'https://ryni.example', changeOrigin: true },
},
},
};

Note there is no data-ryni-server — the tracker defaults to the same origin, so it posts to /t/<tracking_id> on your own domain.

The ingest accepts Variant B requests only when they carry a browser Sec-Fetch-Site: same-origin (or same-site) header. Real browser beacons always send it; the proxy forwards it unchanged. A bare curl/wget to the endpoint (no such header) returns 403 — that’s expected, not a misconfig. For a hard, unspoofable boundary, put Rýni behind your own auth or a shared-secret proxy token.