Skip to main content
Integrate a fully functional referral dashboard into your product. Your users see their stats, referral links, and earnings - all within your app’s interface.

Overview

The embedded dashboard displays:
  • Referral link with copy functionality
  • Performance metrics (clicks, leads, sales)
  • Commission earnings and payout status
  • Optional program description card
  • Coupon codes (with optional self-service creation)
  • Marketing resources and creatives

Integration Flow

1

Your Server calls Affonso API

POST /v1/embed/token with user data (email, name, image)
2

Affonso returns token

Response includes publicToken, expiresAt, affiliate link, and partnershipStatus
3

Frontend renders iframe

Embed the dashboard using the token in the iframe URL

Step 1: Generate Token

Create an API route on your server that generates a token. This keeps your API key secure.

Body Parameters

string
required
Your affiliate program ID.
object
required
Information about the user you want to display the dashboard for.
string
Affiliate group ID to assign the user to. If not specified, the user is assigned to your program’s default group. Use this to place users in specific commission tiers. Find your group IDs in Dashboard → Affiliate Program → Groups.

Example Request

Response

New users are automatically registered as affiliates. Their partnership status depends on your program’s Access Mode setting:
  • Public: partnershipStatus is APPROVED – affiliate can start referring immediately
  • Private: partnershipStatus is PENDING – requires manual approval in your dashboard
  • Invite: partnershipStatus is APPROVED – but only pre-invited affiliates can join

Step 2: Render the Dashboard

Use the publicToken in an iframe to display the dashboard.
For more reliable iframe delivery when ad blockers or privacy tools are present, see Proxy Setup (Optional) for the first-party proxy approach.

Next.js Example

1. Create API Route

First, create a server-side API route that generates the token:

2. Create the Page Component

Then, fetch the token from your API route and render the iframe:

Token Lifecycle

Always generate tokens server-side. Never expose your API key to the client.

Customization

URL Parameters

Add these parameters to the iframe URL for customization:

Supported Languages

The dashboard supports 16 languages: If an invalid language code is provided, the dashboard falls back to English. Example with dark mode, custom background, and German:
Example with light mode, Japanese, and the optional description card enabled:

Brand Colors

The dashboard inherits your brand colors from Portal Settings:
  • Primary Color - Buttons, links, accents
  • Secondary Color - Highlights, backgrounds
Configure colors in HEX format (e.g., #881337) in your Affonso dashboard under Portal Settings.

Visual Preview Editor

Don’t want to write code to test settings? Use the visual editor:
  1. Go to Affiliate Program → Appearance
  2. Click the Embed tab
  3. Customize in real-time:
    • Theme: Light, dark, or system (follows user’s device preference)
    • Language: Select from 16 languages – preview updates instantly
    • Background: Pick a color that matches your app
    • Card visibility: Toggle header, description, rewards, reports, and resources
  4. Click Integration Code to copy the configured code snippets
The preview shows your actual branding (logo, colors) so you know exactly what users will see.
Embed preview editor in Affonso dashboard