βSDK Setup & Installation
Last updated
The Fuul Web SDK gives you access to all the functions needed to integrate Fuul into your website β tracking referrals, displaying leaderboards, managing affiliate codes, claiming rewards, and more.
This guide assumes you have already created a Fuul account and generated an API key. See API Key Management for details.
npm install @fuul/sdk# or using yarn
yarn add @fuul/sdkBefore using any SDK method, initialize it with your API key at the root of your app:
import { Fuul } from '@fuul/sdk';
Fuul.init({ apiKey: 'your-api-key' });When using Next.js App Router, initialize the SDK in a client-rendered component ('use client').
The API key you pass to Fuul.init() depends on what your app needs to do:
Display leaderboards, rewards, or user data
read-only
Track pageviews and wallet connections (frontend)
send:tracking_event
Send custom trigger events (backend only)
send:trigger_event
Manage audiences programmatically (backend only)
service_role
Most frontend integrations use the send:tracking_event key, which covers both reading data and sending tracking events.
After initializing the SDK, the typical integration steps are:
Track referral visits and wallet connections
Let users create affiliate links or codes
Display leaderboard rankings
Show individual user rewards
Build a claiming page for onchain rewards
For a high-level overview of which features require SDK integration, see Build Your Incentives Hub.
Last updated