đCreating affiliate links or codes
Creating affiliates tracking links using Fuul SDK
To create tracking links use the generateTrackingLink
method. This generates a tracking link for the affiliate to share your program link.
baseURL
: the URL of your website (where the pageview and connect wallet events are implemented)
affiliateAddress
: the address of the affiliate. Usually, it is the one that is connected to the site.
You can find an example of two landing pages (one for creators and another one for end users) with the Fuul SDK integrated using next JS and RainbowKit in this repo
Managing affiliate codes using Fuul SDK
By default, affiliate links have the af=affiliateAddress
parameter to identify the affiliate that referred the click.
Fuul allows affiliates to create their own codes to hide their addresses and make prettier links.
Check out the following example to get a better idea.
Creating affiliate codes
Affiliates can create their codes on the Fuul Hosted solution, but projects can also choose to add the functionality to their website.
To create codes using the SDK, use the createAffiliateCode
method.
address
: the address of the affiliate. Usually, it is the one that is connected to the site.
code
: the affiliate code to be created.
signature
: the resulting signature of the address signing the following formatted message:
accountChainId
: the chain id of the smart contract wallet. Do not include it when the wallet is an EOA.
I confirm that I am creating the ${{affiliateCode}} code on Fuul
E.g. I confirm that I am creating the my-affiliate-code code on Fuul
Return values
The method either succeeds and the code is registered or it throws one of the following errors:
ValidationError
: The affiliate code has an invalid character. Codes can only be alphanumeric separated by dashes (-). E.g. my-affiliate-code
InvalidSignatureError
: The signature is not valid for the address and message
AddressInUseError
: The address has already created an affiliate code
CodeInUseError
: The code has already been taken by another user
Updating affiliate codes
To update an affiliate code, use the updateAffiliateCode
method.
address
: the address of the affiliate. Usually, it is the one that is connected to the site
code
: the new affiliate code
signature
: the resulting signature of the address signing the following formatted message:
I confirm that I am updating my code to ${{affiliateCode}} on Fuul
E.g. I confirm that I am updating my code to my-affiliate-code on Fuul
accountChainId
: the chain id of the smart contract wallet. Do not include it when the wallet is an EOA.
Return values
The method either succeeds and the code is registered or it throws one of the following errors:
ValidationError
: The affiliate code has an invalid character. Codes can only be alphanumeric separated by dashes (-). E.g. my-affiliate-code
InvalidSignatureError
: The signature is not valid for the address and message
CodeInUseError
: The code has already been taken by another user
Getting the affiliate code registered to an address
To get the affiliate code for a specific address using the SDK, use thegetAffiliateCode
method.
The return value will be either the code or null in case there is no code created for the input address.
Checking if an affiliate code is free to use
To check whether an affiliate code is free to use or taken using the SDK, use the isAffiliateCodeFree
method.
The return value will be True
if the code is free to use or False
if it is already taken.
Last updated