API Reference
API V1Analytics API (deprecated)Tracking APITrack via WebsocketsTrack via HTTP

Tracking API Reference

Welcome to the Tracking API.

This API should be used when there is no module available for your language or they doesn't satisfy your needs.

We strive to keep it as simple as possible.

Is something missing from the API? Let us know [email protected]

Events Types

TypeDescriptionRequires extra data
initFirst event to send when starting the appyes
eventDefault type, for reporting actions or anything elseno
errorSubmit an error, name should contain the error typeyes
useridSet a new user ID for this userno
propsSet propserties for this user ID based on the data field.no
heartbeatWebsockets only: send every minute to keep the connection on. This only require to pass the machineId field alongsideno

The first thing you need to send when the user opens the app is an init event upon which most of the analytics relies on.

If you don't send it first, no data will appear in your dashboard.

Events Data

Nucleus expect to receive the analytics data as a JSON object, containing a data array property.

This array should contain one or multiple events you want to report.

Basic events data

typeStringoptionalEvent type, see below for all the possible values (default: "event")
nameStringrequired if type is event or errorName of the event
sessionIdIntegerrequired4-digits number that identifies the current session
dateStringoptionalDate of the event (ISO 8601 or milleseconds since 1970). If not provided we'll use the time the server receives the event.
idStringoptionalShort ID that will be returned in confirmation
userIdStringoptionalIdentify the user
machineIdStringrequiredHashed identifier of the machine (ie mac adress)
payloadObjectoptionalAditionnal data attached to the event

Extra events data

If you are reporting either an error or the first init event, you need to attach those extra data:

platformStringrequireddarwinUsually 'win32', 'windows', 'mac', 'darwin' or 'linux'
osVersionStringrequired18.2.0Current installed version of the OS
totalRamIntegerrequired8Total RAM available on the user device
versionStringrequired0.1.0Version of the app installed
languageStringrequireden-USLocale of the user

They are not required with regular events to save bandwidth.


"data": [{
"event": String, // Name of the event
"id": String, // OPTIONAL A random id for the event that will be returned when the query succeeds, can be used to make sure no events are reported two times.
"userId": String, // A string to identify the user
"machineId": String, // A hashed identifier of the machine
"sessionId": Int, // A random 4-digits number that identifies the current session
"platform": String, //
"osVersion": String, // The version of the OS
"totalRam": Int, // The total number of RAM available, in GB
"version": String, // Installed version of the app
"language": String, // Locale of the user (i.e. 'en-US')
"payload": {}, // Any additionnal data that you want to report along the event

Track via Websockets

This is the recommended protocol to submit data.

It is the most efficient in terms of bandwidth and battery. This is what the modules use behind the scenes.

Latency will be vastly better compared to normal HTTP requests.

Endpoint: wss://app.nucleus.sh/:appId/

Send your data as a JSON serialized string message.

To prevent data lost due to network errors, when Nucleus receives an event it will send your client a message containing an array reportedIds of the previously reported events so you can safely assume they were handled by the server.

Track via HTTP

Use this if you'd like to report data where Websockets aren't available.

Keep in mind that with the HTTP method the "Live view" in the dashboard won't work.

POST https://app.nucleus.sh/app/:appId/track

datarequiredArray of events objects

This endpoint doesn't require authentication but is subject to IP rate limiting.

If you expect lots of events to be reported within a short time interval, you should condense them under one request. For example, save the events in memory (with their correct date), and every 30 seconds report them to the server.

Nucleus will respond with an array reportedIds containing the IDs of the events just reported.