getCampaignReferralStats([payload,])

We expose some useful campaign information via the SDK, this is accessible via the getCampaignReferralStats method

const campaignId = 'aSlug3293';

const stats = await client.getCampaignReferralStats({
    campaign: {
        id: campaignId
    },
});

Params

ParamRequiredTypeDescription

campaign.id

required

string

the id of the program/campaign to fetch stats for

Response

FieldTypeDescription

generated_at

Date

the timestamp the stats were generated at (we cache stats for 5 minutes)

referrers

{ user_id: string; external_id?: string; wallet_address?: string; email?: string; referral_count: number; links_claimed: number; join_date: Date; rewards: { amount: number; denomination: string; }[]; }[];

A list of stats per active referrer on the program

Examples

import { ChainvineClient } from '@chainvine/sdk';

const userWalletAddress = '0x293kdo0ij0';
const campaignId = 'aSlug3293';

const client = new ChainvineClient(); //Make sure to whitelist your domain

const stats = await client.getCampaignReferralStats({
    campaign: {
        id: campaignId
    },
});

Last updated