Leverage cookies
In additional to the ChainvineClient operations, we offer a few global utility methods to assist in keeping track of referrals through the use of cookies.
Storing a Referrer
import { storeReferrer } from '@chainvine/sdk';
// Fetches the "r" query parameter from the URL (if available)
// and stores it in a CV_REF cookie with an expiration of 120 days
storeReferrer();storeReferrer({
durationDays: 30, //Override the default cookie duration (120 days)
referrer: 'ABC123', //Should you already have access to the referrer, and if you do not want it fetched from the URL, you can provide it directly
}); Fetching a stored Referrer
import { getReferrer } from '@chainvine/sdk';
const referrer = getReferrer();Clearing the stored Referrer
Last updated