Identify users
Replace a generated visitor name with a real account, so the dashboard shows who's actually visiting.
From the browser
Call this right after a visitor logs in on your own site:
window.shonylabs('identify', {
user_id: 'u_123',
name: 'Ada Lovelace',
image: 'https://example.com/avatar.jpg',
gender: 'female',
plan: 'pro'
});Calling identify before the tracking script has loaded? Queue it with a small stub in <head>first, so early calls aren't lost:
<script>
window.shonylabs = window.shonylabs || function() {
(window.shonylabs.q = window.shonylabs.q || []).push(arguments);
};
</script>From your own server
Use the /v1/identifyAPI when you only know who a visitor is on your backend — e.g. right after a signup webhook. It's authenticated with your site's API key, not the public site ID:
curl -X POST https://api.shonylabs.com/v1/identify \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id": "u_123", "name": "Ada Lovelace"}'Site ID vs. API key
The site IDis public — it's embedded in your tracking snippet and safe to expose in client-side HTML. The API key is a secret that can write identity and transaction data for your site, so it should only ever be used from your own server, never in browser code.
Reserved fields and limits
user_id is required; name, image, and genderare optional and override the visitor's display in the dashboard. Identifying the same user_id from multiple devices or browsers merges them into a single visitor in the dashboard. Up to 10 additional custom properties are allowed, with lowercase key names and markup-stripped values.