Overview
Referral Rocket makes it easy to interact with your data via our Javascript SDK. This article explains the Referral Rocket JavaScript Web APIs, showing how to use each method with examples.
Last updated
Referral Rocket makes it easy to interact with your data via our Javascript SDK. This article explains the Referral Rocket JavaScript Web APIs, showing how to use each method with examples.
Last updated
Install Referral Rockets library that attaches the Rocket library to the global window. Replace the campaign ID with your campaign ID. Place this script in the <head> section of your website.
Verify Installation
You can confirm that the Rocket object is available by opening the browser window and enter window.Rocket. If the installation is successful, it will return an instance of the Referral rocket object.
Retrieves the details of your campaign.
Retrieving Campaign Using a Promise
The Add Participant method allows you to add a new participant—either referred or direct. A notable feature of this method is that passing a referral code or referral email is optional. The system will automatically detect the referral from the stored cookie and add it to the participant’s information.
Method Signature
Parameters
data
Object
An Object containing the participant email and any other additional data to include for the participant.
Example Object: {
email: 'john@gmail.com', fName: 'John', lName: 'Taylor', referredByCode{optional]: 'dkghdgzd',
referredByEmail[optional]:'mike@gmail.com'
}
Referred by fields are optional. If a referral is detected via a cookie, it will be automatically associated with this participant.
Description of Object Properties
email: The email of the participant.
fName: The first name of the participant.
lName: The last name of the participant.
referredByCode [optional]: The referring customers unique code, typically used to track the referring participant. Only required for referred participants.
referredByEmail [optional]: The referring customers email, typically used to track the referring participant. Only required for referred participants.
Adding Participant with Object Using a Promise
Example Response
Retrieves limited details of an existing participant by their email or Referral-code.
Parameters
Parameter
Data Type
Description
data
Object
(Required) An Object containing either the email or the referral code of the participant to retrieve.
Description of Object Properties
Example Response
The Qualify Participant method is used when an user makes a payment or performs a reward qualifying event (such as sign up, etc) indicating a referral has occurred and referrer is eligible for reward.
The system takes the email address of a referred participant and marks their qualifying event (sign up, purchase, etc) as complete in the campaign. This will trigger the referring participants to be eligible for a reward.
The system will automatically detect the referral from the stored cookie and add it to the participant’s information.
Parameter
Data Type
Description
data
Object
(Required) An Object containing the email of the participant. (Optional) Amount spent by the participant.
Description of Object Properties
amountPaid
Using the getReferrralCode()
function returns the referral code if available. If a referral code is not found, it will return null
.
Example Usage: