Skip to main content
Record any custom events in your app, along with properties that describe the action. Custom events can capture a broad range of actions, such as starting a swap or completing a deposit. Additional information about the event can be included in the properties field. For example, for a Swap Completed event, you may want to include the token pair, input amount, and output amount.

Naming events

When naming events, Formo recommends establishing a consistent naming convention that uses:
  • Consistent formatting: Event names are case sensitive.
  • A consistent syntax: Adopt nouns and past tense verbs like Swap Completed and Deposit Submitted. A standard of [Noun] + [Past-Tense Verb] ensures all your events are consistent.
  • A consistent actor: Does Transaction Submitted mean that the user submitted a transaction or that your app submitted it on their behalf? If all your events are named in a way that reflects the user’s perspective, the meaning is clear immediately.
This allows everyone including you 6 months from now to instantly understand the meaning of an event.

Properties

Properties are additional information that give more clarity of your users’ actions. Every custom event has type set to track and event set to your custom event name, with the event-specific data passed in the properties object:
Formo has reserved some standard properties listed in the following table and handles them in a special manner.

Tracking volume, revenue, points

You can track volume, revenue, and points in your events. Once tracked, they are shown on the dashboard. Include these optional properties in a custom event to track values associated with an action.
Revenue tracking.

Revenue tracking.

For example, call .track() with the reserved properties alongside any other event properties:

Deduplicating events

The Web and Mobile SDKs deduplicate custom events in two ways. Automatically, for 60 seconds. When track() is called twice within 60 seconds with the same event name, properties, and context, for the same wallet and user, the SDK sends the event once. This handles accidental double-fires, such as a React effect that runs twice. It applies within one page or app session. With an idempotency key, for retries. For business-critical events, add the reserved idempotency_key property with a stable identifier for the action, such as an order ID. Every call that reuses the key for the same event name gets the same message ID, so ingestion keeps one event however many times it is sent, including across page reloads and app restarts.

Delivery callback

track() accepts a callback as its fourth argument. It runs once the SDK’s delivery attempt for that event settles:
A callback without an error means the events API accepted the batch, not that downstream processing has finished. A call the SDK recognises as a duplicate is never sent and does not invoke its callback.

Sample Payload