Overview
track() is the core function of Analytiq. Call it whenever something meaningful happens in your app — a page visit, a button click, a purchase, a form submission.
Each event gets saved to your dashboard instantly.
Signature
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
eventName | string | Yes | Name of the event. Use lowercase with underscores: page_view, button_click |
properties | object | No | Key-value pairs with extra data about the event |
Properties value types
Properties can only contain these value types:| Type | Example |
|---|---|
string | 'home', 'pro', 'google' |
number | 29, 3, 100 |
boolean | true, false |
null | null |
Examples
Simple event — no properties:Event naming conventions
Use lowercase words separated by underscores:| Good | Bad |
|---|---|
page_view | PageView |
button_click | Button Click |
purchase_completed | purchaseCompleted |
Built-in features
Auto-deduplication: If you accidentally calltrack() twice with the exact same event name and properties within 300ms, the second call is silently ignored. This prevents double-counting.
Auto-queue: If track() is called before init() runs, the event is queued in memory and sent automatically once init() is called.
Auto-retry: If the network request fails, the SDK retries once after 500ms.