Skip to main content

Instructions

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.
Pick your stack and add the code below to your codebase.
  • Website
  • React
  • Next.js app router
  • Next.js pages router

1. Install the Formo SDK

Install this script in the <head> tag of your website. Replace <YOUR_WRITE_KEY> with the SDK Write key found in your project settings:
<script
  src="https://cdn.formo.so/analytics@latest"
  defer
  onload="
    window.formofy('<YOUR_WRITE_KEY>', {
      ready: function(formo) {
        formo.identify();
      }
    });
  "
></script>
Calling identify at the start of every session or page load links wallets to user sessions.To improve security, enable Subresource Integrity (SRI).

2. Track events (optional)

Formo autocaptures events like page views, wallet connects, signatures, and transactions for you.For everything else, 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!

SDK Reference

Code Examples

Support

I