Install the Blossu SDK and start tracking referrals in your Next.js application in under 5 minutes.
Add the Blossu SDK to your Next.js project using npm or yarn.
npm install @blossu/uiOr if you prefer yarn:
yarn add @blossu/uiAdd the ReferralTracker component to your root layout to track all pages. This will automatically capture referral clicks and store the referral ID.
import { ReferralTracker } from "@blossu/ui/react";
export default function RootLayout({ children }) {
return (
<html>
<body>{children}</body>
<ReferralTracker programId="YOUR_PROGRAM_ID" />
</html>
);
}Replace YOUR_PROGRAM_ID with your actual program ID from the Blossu dashboard. You can find this in your program settings.
To verify the installation is working correctly:
Visit your site with a test referral link (e.g., yoursite.com?via=test)
Open your browser's developer console
Check if window.blossu_ref_id is defined
When a visitor arrives via a partner referral link (e.g., yoursite.com?via=partner), the script automatically captures the referral and stores it in window.blossu_ref_id. This ID is then used to attribute any purchases to the referring partner.
The referral ID is also stored as a first-party cookie, so it persists for 60 days even if the visitor closes their browser and returns later.
Now that you have tracking set up, you need to connect your payment platform to automatically track conversions and calculate partner commissions.
Next article
How to track affiliates and revenue with Stripe