Web SDK
Track user events in web applications with the Formo Web SDK.
The Formo Web SDK is open source and implements the standard Events API.
Installation
Install the JavaScript SDK via CDN or NPM.
Code examples
Check out working examples of Formo on Github:
Example Next.js app
A working example of Formo in a Next.js app.
Example React app
A working example of Formo in a React app.
Autocapture
The Web SDK automatically captures common events such as page views and wallet events (connect, disconnect, signature, transaction, etc) with full attribution (referrer, UTM, referrals.)
You do not need to configure anything to track these events.
Identify
Call identify()
after a user connects their wallet or signs in on your website or app:
If no parameters are specified, the Formo SDK will attempt to auto-identify the wallet address. Note that most wallets block automatic wallet fingerprinting by default.
Custom events
Track custom user actions with the track()
function:
Configuration
Local testing
The SDK skips tracking in localhost by default. To enable tracking locally during development, set trackLocalhost
to true
:
Debugging
Control the level of logs the SDK prints to the console with the following logLevel settings:
Batching
To support high-performance environments, the SDK sends events in batches.
Customize this behavior with the flushAt
and flushInterval
configuration parameters.
Log Level | Description |
---|---|
trace | Shows the most detailed diagnostic information, useful for tracing program execution flow. |
debug | Shows all messages, including function context information for each public method the SDK invokes. |
info | Shows informative messages about normal application operation. |
warn | Default. Shows error and warning messages. |
error | Shows error messages only. |