Overview
The Reditus referral widget is loaded via the Pageview Tracking Script, that should already be installed in your app. You should add the following snippet where your frontend has access to user data and the JWT token from your backend. Once you invoke thegr("loadReferralWidget", ...)
method, it automatically fetches the referral program code and makes the widget available through window.referralWidget
.
Example Usage
Javascript
Parameters
Parameter | Type | Description |
---|---|---|
product_id | string | Required. The Product ID from your Reditus configuration, available at app.getreditus.com/saas/referral_program/config/authentication. |
auth_token | string | Required. A JSON Web Token (JWT) generated on your server using your Reditus product secret. Refer to Authenticating the User for details on token creation. |
user_details | object | Required to send at least one field within. Contains user information to associate referral program data with a specific user. (See breakdown of nested fields below.) |
user_details.first_name | string | The user’s first name. |
user_details.last_name | string | The user’s last name. |
user_details.email | string | Required on free plan for sending email notifications towards the advocate. The user’s email address. |
user_details.company_id | string | The company ID or organization associated with the user. |
user_details.company_name | string | The company name or organization associated with the user. |
Next steps
Check out Authenticating the User to learn how to generate theauth_token
(JWT).