Appearance
For developers
Replora has three surfaces for developers: the tracking script that runs on your visitors' pages (with a small command queue, window.__sr, and npm packages for apps), the versioned REST API under /api/v1 that the dashboard itself uses, and the module system that the whole server application is built from.
Tracking
The tracking scriptThe snippet, its attributes, Google Tag Manager, npm packages, CSP and what the script sends where.OpenJavaScript APIEvery window.__sr command: identify, tagSession, event, virtualPage, optOut, crossDomain…OpenPrivacy & maskingWhat is masked by default, the sr-mask / sr-block classes, data-sr-* attributes and site rules.OpenSingle-page apps & framesVirtual page views, routers, iframes of other domains, cross-domain sessions.Open
Server
REST APIBearer tokens with abilities, one error shape, paging, rate limits and every endpoint group.OpenWebhooks & integrationsAlert emails, Slack and signed webhooks; HubSpot; Google Analytics events.Open
Extending and building
Architecture & modulesCore plus modules/ and saas/modules/, contracts, events and dashboard extensions.OpenWriting a moduleA new feature folder step by step: module.json, provider, routes, a dashboard page, tests.OpenBuilding from sourceThe pnpm monorepo, Node and Composer, builds, checks and 100 % coverage.OpenReleases & module packsSigned release zips, the update feed and the core module pack.Open
Quick example
The tracking code, then a few commands from your own pages:
html
<script async src="https://replora.example.com/t.js" data-site="YOUR_SITE_KEY"></script>
<script>
window.__sr = window.__sr || [];
__sr.push(['identify', '[email protected]', { plan: 'pro' }]);
__sr.push(['tagSession', { cart_value: 129 }]);
__sr.push(['event', 'signup', { plan: 'pro' }]);
</script>Read the sessions back from a script with a token:
sh
curl https://replora.example.com/api/v1/sites/1/sessions?per_page=5 \
-H "Authorization: Bearer $REPLORA_TOKEN" \
-H "Accept: application/json"Your site key and server address
Both are on the website's Install page in the dashboard (Websites › your site › Install). The snippet there is already filled in.
How the pieces talk
| Piece | Talks to | How |
|---|---|---|
Tracking script (/t.js) on your pages | /c/{key}, /i/{key}, /s/{key}, /x/{key} on your Replora server | Public CORS requests without cookies; see what the script sends |
| Dashboard (React) | /api/v1/… | Same-site session cookie (Sanctum) |
| Mobile app, scripts, other servers | /api/v1/… | Authorization: Bearer <token> |
| Alerts | Your email, Slack, your webhook URL | Signed JSON POST, see webhooks |
