
Installation
IMPORTANT: To enable accurate attribution, install Formo on both your website (example.com) and your app (app.example.com) using the same project/SDK write key.
Websites
Install this snippet at the<head>
of your website:
React & Next.js
Install the JavaScript SDK via CDN or NPM.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 users
Callidentify()
after a user connects their wallet or signs in on your website or app:
Track events
Track user actions by calling thetrack
function:
Code examples
React example
formo-example-react
Next.js (app router) example
formo-example-next-app-router
Next.js (pages router) example
formo-example-next-page-router
Blocknative / Web3 Onboard example
formo-example-web3-onboard
Thirdweb example
formo-example-thirdweb
Reown example
formo-example-reown
Privy example
formo-example-privy
Porto example
formo-example-porto
Farcaster Mini App example
formo-example-farcaster
Configuration
Local testing
The SDK skips tracking in localhost by default. To enable tracking locally during development, settracking
to true
:
Logging
Control the level of logs the SDK prints to the console with the following logLevel settings: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. |
Batching
To support high-performance environments, the SDK sends events in batches.flushAt
and flushInterval
configuration parameters.
Ready callback
Theready
callback function executes once the Formo SDK is fully loaded and ready to use. This is useful for performing initialization tasks or calling SDK methods that require the SDK to be ready.
onload
attribute:
Environments
You can control tracking behavior in different environments (test, staging) with thetracking
option: