SDK methods
Every SDK has the same small set of methods. The examples use the browser SDK (the traceiq singleton from traceiq-sdk-js); the last section lists the names in the other SDKs.
How TraceIQ tracks a person
On the first visit the SDK creates an anonymous ID and keeps it in localStorage, so every event from that browser is connected even before sign-in. When you call identify(), the events that follow carry your user ID, and TraceIQ links the anonymous history to the same profile.
The signed-in user and their group live in memory, not in storage. Call identify() and group() every time your app loads with a signed-in user (for example where your auth state resolves), not only on the sign-in screen. Otherwise events after a page refresh are recorded as anonymous.
// e.g. in your auth provider, once the session is known
if (session?.user) {
traceiq.identify({
userId: session.user.id,
traits: { email: session.user.email, name: session.user.name, plan: session.user.plan }
});
traceiq.group({
organizationId: session.user.departmentId,
traits: { name: session.user.departmentName }
});
}identify()
traceiq.identify({ userId: 'user_123', traits: { email: 'ada@example.com', name: 'Ada', plan: 'pro' } });The first call creates the person's profile in Users; later calls merge new traits into it, so a trait you send again replaces the old value and traits you leave out are kept. Traits that look like secrets (password, token, api_key, card details) are dropped before they are stored. Calling identify() again with the same ID is cheap, so it is safe to call on every load.
track()
traceiq.track('checkout_started', { cartValue: 4200, currency: 'NGN', items: 3 });Events appear in Events within seconds and can be counted in Insights, chained in Funnels and compared in Retention. Pick names once and keep them stable, because a renamed event starts a new series. Names starting with $ are reserved for events the SDK sends itself ($page, $identify, $group, $exception, $api_request).
page()
traceiq.page(); // uses document.title
traceiq.page('Pricing', { plan: 'pro' }); // custom name and extra propertiesSends a $page event with the URL, path, referrer and title; it powers Web analytics and page breakdowns elsewhere. autoTrackPageViews: true only records the first page, so single-page apps (React, Next.js, Vue) should also call page() when the route changes:
'use client';
import { usePathname } from 'next/navigation';
import { useEffect } from 'react';
import { traceiq } from 'traceiq-sdk-js';
export function PageViews() {
const pathname = usePathname();
useEffect(() => { traceiq.page(); }, [pathname]);
return null;
}group()
A group is the account a person belongs to: the company in a B2B product, a team, a school, or a department in a university portal. group() tells TraceIQ which group the signed-in person is in, so you can see activity per account and not only per person.
traceiq.group({
organizationId: 'dept_csc', // your stable ID for the account
traits: { name: 'Computer Science', faculty: 'COLPHYS', plan: 'campus' }
});What you get
Each group appears on the Groups page (under Analytics) as soon as its first group() call arrives. The list shows its members, how many were active in the chosen range, their event count and when they were last active. Opening a group shows its traits, a daily activity chart, its top events and every member, linked to their user timeline.
How it works
Members— Anyone who called group() for that organizationId becomes a member. Call identify() first, so the member is the signed-in user and not an anonymous ID.Activity— Every event a member sends counts toward the group: their page views, tracked events, errors and API calls. The $group, $identify and $alias events themselves are not counted.Traits— The group shows the traits from its most recent group() call that included any. They describe the account and never change the person’s own profile.Several groups— A person can be in more than one group: call group() once for each. Their activity then counts toward each of them.
Setting it up
- Decide what an account is in your product (company, team, department) and which ID identifies it.
- Where your app learns who is signed in, call
identify()and thengroup(), on every load. - Pass a
nametrait, or the Groups page shows the raw ID. - Open Groups and check the account is listed, then open it to see its members.
From a server or another SDK
Server SDKs have no session, so pass the person as well. This is also how to backfill memberships for people who will not open the app soon:
// traceiq-node
traceiq.group({ organizationId: 'dept_csc', userId: 'user_123', traits: { name: 'Computer Science' } });# traceiq-py
client.group("dept_csc", user_id="user_123", traits={"name": "Computer Science"})The Flutter SDK has no group() yet. Send the same event with track(); TraceIQ reads it the same way:
await TraceIQ.track(r'$group', properties: {
'organizationId': 'dept_csc',
'traits': {'name': 'Computer Science'},
});alias()
traceiq.alias('user_123', 'guest_8f2c'); // the new ID first, then the old oneidentify() already links the browser's anonymous ID, so most apps never need alias(). Use it when one person has had two of your user IDs, such as a guest checkout ID that later becomes an account. previousId defaults to the current ID in the browser; server SDKs take both IDs. TraceIQ records the link as an $alias event today; merging the two profiles in reports is coming in a later release.
captureException()
try {
await pay(order);
} catch (error) {
traceiq.captureException(error, { orderId: order.id });
showPaymentError();
}Uncaught errors and unhandled promise rejections are captured automatically (autoCaptureExceptions). Use captureException() for errors you catch and handle, which would otherwise go unseen. Each one becomes a $exception event, grouped into issues on the Errors page; the extra properties show on each occurrence. Set the release option and upload source maps to see the original code in stack traces.
log()
traceiq.log('warn', 'Payment provider slow', { provider: 'paystack', ms: 4200 });
traceiq.log('error', 'Result upload failed', { error, courseId: 'CSC201' });Sends a structured line to Logs, tagged with the session and user. Levels are debug, info, warn and error. Lines are sent in small batches, and any left are flushed when the page is hidden. Pass error to attach its stack, or service to name the source.
Names in other SDKs
Feature flags, experiments, surveys and session replay have their own pages in the sidebar.

