POST/capture
Capture an event
Record an event to track user actions or system behavior.
import Seerstack from 'seerstack';
const client = new Seerstack({ apiKey: process.env['SEERSTACK_API_KEY'],});
const response = await client.events.capture({ name: 'invoice.paid', user_id: 'user_123', data: { invoice_id: 'inv_993', amount: 2000, currency: 'usd' }});
console.log(response.success);POST/identify
Identify a user
Associate traits and attributes with a user ID. Once identified, all future events with this user_id will be enriched with these attributes.
import Seerstack from 'seerstack';
const client = new Seerstack({ apiKey: process.env['SEERSTACK_API_KEY'],});
const response = await client.users.identify({ user_id: 'user_123', email: 'grace@hopper.com', name: 'Grace Hopper', attributes: { plan: 'enterprise', team_size: 15, is_admin: true }});
console.log(response.success);