🏹Tracking API
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 hello@nucleus.sh
Event Types
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.
Nucleus uses the init event to track the number of sessions. Make sure you send a new init event whenever a new session is created. We know it might be difficult to track this properly if you're only sending events from your backend. One solution could be to save the last event timestamp of each session in an in-memory storage and create a new session if more than 30 minutes passed since the last request.
Events Data
Nucleus expects 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
Extra events data
If you are reporting either an error or the first init event, you can attach the following extra data:
They are not required with regular events to save bandwidth.
Example:
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
POST
https://app.nucleus.sh/app/:appId/track
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.
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.
Path Parameters
Request Body
Last updated