Skip to main content

What is batchTrack?

batchTrack() lets you send multiple events in one request to the Analytiq server instead of making separate requests for each event. Think of it like this:

When to use batchTrack vs track

Rule of thumb: If your events happen at exactly the same time (e.g., when a component mounts), use batchTrack(). If they happen at different times based on user actions, use track() individually.

Basic usage

Each item in the array has:
  • name (required) — the event name
  • properties (optional) — same key-value pairs as track()

React — App startup tracking

pages/Dashboard.jsx

Next.js App Router


Vue 3


Vanilla HTML


With user identity

If the user is already logged in when the batch fires, you can include userId per event:
Or explicitly per event:

TypeScript types