Spindl
  • 👋Overview
    • Introduction
    • Attribution
    • Privacy
  • Your Spindl app setup
    • Managing team members
  • 🪄Features
    • 📈Onchain Attribution
      • 📉Plotting attribution
    • 📊Web3-native Analytics
      • Chart Builder
      • Event Selection and Filtering
      • Line Chart
      • Funnel
      • Cohort Retention
      • Sankey Diagram
      • Big Numbers
      • Pies and Donuts
    • 🧍‍♂️Audiences
      • Creating an audience
    • 🔗Short Links
      • 🖇️Custom Domains
    • 🤝Referrals
      • Management and reporting
      • ⏩Quick Start
      • ⛓️Technical Details
  • ⚙️Techncial
    • ⏩Start Here
    • Google GTM Guide
    • Javascript SDK / HTML Script Guide
      • ➡️Install
      • ➡️Wallet Connects
      • ➡️Page Views
      • ➡️Custom Events
      • ✅Verify That Events Are Sent Correctly
      • React, Next.js & Html Examples
      • Setup a Reverse Proxy
        • Using Next.js
        • Using Cloudflare Workers
        • Netlify
      • ➡️Referrals
      • Default vs Lite SDK Versions
      • Security
    • API
      • ➡️Short Links
      • ➡️Custom Events API
      • Data Exports
    • Android SDK
    • iOS (Swift) SDK
    • On-Chain
      • ➡️Rewards
  • Contact Spindl
  • Ads
    • ⏩Start Here
    • 📢Creative Specifications
      • Web Banner Ads
      • Discord Embeds
Powered by GitBook
On this page
  • Get Referrer Code
  • Create Referrer Code
  • Validate Referrer Code
  • Check Referrer Code
  1. Techncial
  2. Javascript SDK / HTML Script Guide

Referrals

PreviousNetlifyNextDefault vs Lite SDK Versions

Last updated 9 months ago

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 , 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

⚙️
➡️
Spindl Dashboard