Referral Widget
Embed the RefRef widget to enable participant referrals
Overview
The RefRef widget is an embeddable UI component that allows participants (your users) to:
- View their unique referral codes and links
- Share referrals via social media, email, or copy link
- Track their referral performance and rewards
- See their referral history
The widget is built with Web Components for framework-agnostic integration and uses Shadow DOM for style isolation.
How It Works
- User logs into your application
- Your backend generates a JWT token for the user (using their
externalId) - Widget is embedded on your page with the JWT token
- Widget fetches the user's refcodes, programs, and stats from RefRef API
- User can share their referral link and track performance
Installation
Step 1: Add the Widget Script
Add the widget script to your page:
Step 2: Generate JWT Token (Backend)
The widget requires a JWT token to authenticate the participant. Generate this token on your backend:
Never expose your client secret in frontend code! Always generate the JWT on your backend.
Step 3: Embed the Widget
Add the widget component to your page:
Widget Attributes
Customization
Styling
The widget uses Shadow DOM for style isolation, but you can customize via CSS custom properties:
Layout
Control widget width and height:
Widget Features
Events
Listen to widget events in your application:
Programmatic Control
Control the widget via JavaScript: