➡️Referrals

Referral codes are a core primitive of Spindl's referral program. Each wallet can create one unique code, that can be shared via the ref tag on URLs. Codes can be custom or random, depending on your ideal app experience.

For instance, a shareable link might look:

https://app.mydapp.xyz/trade?ref=kunal
                                 ^ referral code

The Spindl SDK will automatically capture ref URL parameters in Page View events to associate visits with Referrers.​

Referral codes can be created manually through the Spindl Dashboard, or programmatically from your app with the Javascript SDK.​

Get Referrer Code

This method can be used to see if a wallet already has a code associated with it.

SDK Method

getReferrerCode(address: string): Promise<string | undefined>

Parameters

  • Address: The wallet address

Returns

A referral code if set​

Create Referrer Code

SDK Method

createReferrerCode(address: string, code?: string): Promise<string>

Parameters

  • Address: The wallet address

  • Code: An optional custom referral code to use. If not set, we'll generate a random code

Returns

This will throw a 400 error if the code is invalid / in-use, or the wallet address already has a referral code

Validate Referrer Code

This method can be used to quickly verify if a code is valid (it doesn't make network calls, so can be called on keystrokes / input changes efficiently)

SDK Method

validateReferrerCode(code: string): boolean;

Parameters

  • Code: A custom short code, to validate

Returns

Returns true if the code is valid.

Check Referrer Code

This method can be used to see if a custom code is already in use.

SDK Method

checkReferrerCode(code: string): Promise<boolean>;

Parameters

  • Code: A custom short code, to check if it is available

Returns

Returns true if the code is available, false if it is not valid or unavailable

Last updated