Program

Embedded referral dashboard

Add a referral dashboard to your app with one script and one tag. Customers join your referral program and track what they earn inside your app.

Inside your app, the embedded dashboard shows a signed-in user their referral link (with a copy button), clicks, customers referred and earnings. They don't need a separate partner login.

1. Mint a token on your server

Call the API with a key that has the partners:write scope. If the user isn't a partner yet, they are created and approved.

import { OpenPromoter } from "openpromoter";

const op = new OpenPromoter({ apiKey: process.env.OPENPROMOTER_API_KEY! });
const { token } = await op.partners.embedToken("prg_123", { email: user.email, name: user.name });

Or with curl:

curl https://app.openpromoter.com/api/v1/programs/prg_123/embed-tokens \
  -H "Authorization: Bearer $OPENPROMOTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"maya@example.com","name":"Maya Chen"}'

The response is { "token": "…", "partnerId": "prt_…", "expiresIn": 3600 }. Tokens last one hour. Mint a fresh one each time you render the page and never expose your API key to the browser.

2. Render the component

<script src="https://app.openpromoter.com/embed.js"></script>

<openpromoter-dashboard program="acme" token="TOKEN_FROM_YOUR_SERVER"></openpromoter-dashboard>

program is your program slug. Add height="320" to change the frame height (230 pixels by default).

The component renders a framed page from your OpenPromoter instance and works in any framework. Self-hosters load embed.js from their own APP_URL.

If the token has expired, the frame asks the user to reload the page.

Edit this page on GitHub