sdks5 min
SDKs
TypeScript · Python · Ruby · Go · cURL examples for every endpoint.
REST API — available now
All Traqly functionality is accessible via the REST API using your workspace API key. The examples below use plain fetch — no additional packages required.
Native language SDKs (TypeScript npm package, Python, Ruby, Go) are on the roadmap and will be published once the API surface stabilises. Watch the changelog for announcements.
Track a server-side event (TypeScript / Node.js)
// No package needed — use the Traqly REST API directly
const TRAQLY_KEY = process.env.TRAQLY_KEY!;
const TRAQLY_HOST = 'https://your-traqly-ingest.example.com';
await fetch(`${TRAQLY_HOST}/api/track`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${TRAQLY_KEY}`,
},
body: JSON.stringify({
type: 'purchase',
value: 149.00,
currency: 'EUR',
channel: 'google',
emailHash: await sha256(email), // hash PII client-side
ip: req.ip,
userAgent: req.headers['user-agent'],
}),
});Verify a webhook signature (TypeScript / Node.js)
import crypto from 'crypto';
function verifyWebhook(rawBody: Buffer, sigHeader: string, secret: string): boolean {
const hmac = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
const expected = Buffer.from(hmac);
const received = Buffer.from(sigHeader);
if (expected.length !== received.length) return false;
return crypto.timingSafeEqual(expected, received);
}Python example
import hashlib, hmac, requests
TRAQLY_KEY = os.environ["TRAQLY_KEY"]
TRAQLY_HOST = "https://your-traqly-ingest.example.com"
requests.post(
f"{TRAQLY_HOST}/api/track",
headers={"Authorization": f"Bearer {TRAQLY_KEY}"},
json={"type": "purchase", "value": 149.0, "channel": "google"},
)