Add analytics to a Railway app Railway.
smolanalytics works two ways for apps hosted on Railway. If Railway serves a web frontend, add two script tags to your root layout head for full autocapture. If you're tracking a backend service, there's no SDK, you POST JSON to /v1/events with a bearer key. Both feed one deterministic, self-hostable analytics instance.
# Backend service on Railway: POST events, no SDK needed
curl -X POST https://YOUR-INSTANCE/v1/events \
-H "Authorization: Bearer WRITE_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"order_created","distinct_id":"user_123","properties":{"value":49}}'For a web app on Railway, use the two script tags in your root head instead. Batch backend events into one POST to save calls.
how do I add analytics to railway?
smolanalytics works two ways for apps hosted on Railway. If Railway serves a web frontend, add two script tags to your root layout head for full autocapture. If you're tracking a backend service, there's no SDK, you POST JSON to /v1/events with a bearer key. Both feed one deterministic, self-hostable analytics instance.
Railway commonly runs full-stack or backend services, so the right method depends on what you're measuring. For server-side events like signups, jobs completed, or webhooks received, skip the browser SDK entirely and POST to /v1/events with an Authorization bearer key, one JSON body per event with name, distinct_id and properties. Batch them when you can.
If Railway is serving your web frontend, the two script tags in your root layout head give you autocapture for pageviews, clicks and errors, and you can identify(userId) on login to tie browser sessions to your backend events under one distinct_id. Everything lands in a single open-source instance you self-host free or run hosted from $29/mo, and you ask it questions in plain English with answers computed, not hallucinated.
Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).
Add analytics to Railway tonight.
One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.