ChainVine API Docs
  • Chainvine
    • Product and Features
    • Technical Overview
  • ⚙️Developers
    • 🔨Use Cases
      • Leverage cookies
      • Link Claimer/Referrer
      • Record Link Click
      • Generate a Referrer Link
      • Record a Transfer Event
      • Complete a Requirement
    • 🖼️Embedded Widget
      • Implementation
      • FAQ
    • 🧰SDK
      • Implementation
      • Configuring the Client
      • Classes and Functions
        • Utility Methods
        • ChainvineClient
          • getReferralUrl(walletAddress)
          • recordClick(referrer)
          • linkReferrer([payload,])
          • referralConversion([payload,])
          • syncUser(walletAddress)
          • getCampaignReferralStats([payload,])
        • ChainvineUser
          • Initializing the client
          • joinCampaign([campaignParams,])
          • getRequirement([payload,])
          • getUserStats([payload,])
          • verifyRequirement([payload,])
          • completeRequirement([payload,])
          • claimEligibleEarnings([payload,])
          • transferEvent([payload,])
          • referral([campaignParams,])
            • linkToReferrer(referrer)
            • url()
          • setRewardTiersOverride([payload,])
        • Errors
        • Authentication
          • Getting your API Key
          • Allow-listing a domain
      • FAQ
    • 🪝Webhooks
    • 📔Open API Specification
  • Rewards
    • Claiming For Users
      • On ChainVine
Powered by GitBook
On this page
  • Params
  • Response
  • Examples
  1. Developers
  2. SDK
  3. Classes and Functions
  4. ChainvineClient

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

Param
Required
Type
Description

campaign.id

required

string

the id of the program/campaign to fetch stats for

Response

Field
Type
Description

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
    },
});
import { ChainvineClient } from '@chainvine/sdk';

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

// Generate your ChainvineClient instance
const client = new ChainvineClient({
    apiKey: '0dj03j000d'  // Your API Key
});

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

Last updated 1 year ago

⚙️
🧰