Instructions

Pick your stack and add the code below to your codebase.

1. Install the Formo SDK

Install this script in the <head> tag of your website:

<script
  src="https://cdn.formo.so/analytics@latest"
  defer onload="window.formofy('<YOUR_WRITE_KEY>');"
></script>

Replace <YOUR_WRITE_KEY> with the SDK Write key found in your project settings.

Enable Subresource Integrity (SRI) to improve site security.

2. Identify users

Call identify to tie a user to their actions. As a best practice, make sure identify is called at the start of every session or page load, if possible.

window.formo.identify({
  address: "0xEee...",
  userId: "foobar"
});

3. Track events

Use the track function to track custom user actions specific to your app.

<button type="button" onclick="window.formo.track('Swap Completed', { foo: 'bar' })">
  Track event
</button>

Autocapture

The Formo 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.

Verification

To verify that the SDK is installed correctly, navigate to your site and open the network tab of the developer tools in your browser.

Wait and look for a ‘raw_events’ request to Formo in the network console. Check that the request returns a 202 response status. If so, you’re done!

Enable logs on localhost to help with debugging or reach out to support.

SDK Reference

Support