Usage

The Split SDK offers on-chain referral rewarding methods for use in browser environments. Learn how to add the SDK and utilize its methods.

Initialize Split SDK

With your API key, initialize the SDK to start leveraging its features:

await split.init(apiKey, config);

Parameters


apiKey (*requiredstring )

A required string that authenticates the your app to the Split.

config (*optionalSplitConfig)

  • Contains settings such as referralParam which defines the query parameter name for the referral code.

  • By default, this parameter is set to "join", but developers can specify a different query parameter name to suit their application's URL structure.

  • Usage Example:

  • const config: SplitConfig = {
      referralParam: "code"  // Custom parameter name for referral code
    };
    
    await splitBrowser.init("YOUR_API_KEY", config);

Method

Here is a method provided by the Split SDK.

addReferral(refereeAddress)

Tracking referrals. By passing the wallet address of the referee, this method records a new referral link between the referrer and the referee.

Please trigger this event when a referee connects their wallet and performs on-chain events(transactions) via a referral link.

Parameters


refereeAddress (*requiredstring)

  • The wallet address of the referee. This address is crucial as it uniquely identifies the new user being referred to the system.

  • Usage Example:

  • await split.addReferral("REFEREE_WALLET_ADDRESS");

Last updated