Server side Tracking
This page presents two HTTP post API endpoints that can be used for tracking from your server
setReferral
This API can be used for user action like connecting wallet on your website and signing up, where we will register the user as referred invitee
on success.
setReferral
POST
https://us-central1-qwestive-referral-prod.cloudfunctions.net/setReferral
Register invitee for the referrer with user's public wallet key and set the current user as the registered invitee in the campaign
Headers
Content-Type
String
application/json
Request Body
secretApiKey*
String
Secret API key which authenticates the calling server
projectId*
String
Unique projectId
publicKey*
String
User's public wallet key
referralCode*
String
Unique code of referrer
// Return the user's public wallet key
{
"result": {
"publicKey": "user_public_wallet_key"
}
}
Sample cURL
curl --location 'https://us-central1-qwestive-referral-prod.cloudfunctions.net/setReferral' \
--header 'Content-Type: application/json' \
--data '{
"secretApiKey": "Or5rr4ssalLD1TpU1HhoHsJ03q00IO32MUSeXeyueQE=",
"projectId": "7VveXIwMqTmecXhkjkUD",
"publicKey": "InviteeNRooBzvZ1WB3UJvQqM8R2CiGcaaEREXMg123",
"referralCode": "rcwgS"
}'
setConversionEvents
This API can be used for sending conversion events with conversion value and revenue value for users already registered in the campaign as invitees.
setConversionEvents
POST
https://us-central1-qwestive-referral-prod.cloudfunctions.net/setConversionEvents
set conversion events for invitees with conversion value and revenue value for a campaign
Request Body
projectId*
String
Unique id of the project
campaignId*
String
Unique id of the campaign
events*
Array
checkout conversion event spec below
secretApiKey*
String
Secret API key which authenticates the calling server
{
successfulInvitees: [],
failedInvitees: [],
}
Conversion event spec
interface TokenSpec {
// The chain this token is on.
chainId: 'eth' | 'sol' | 'matic' | 'optimism';
// The token address of this token (called mint address for solana).
tokenAddress: string;
// The number of decimals this token has.
decimals: number;
symbol?: string;
// token name
name?: string;
// url of the image for token logo
logo?: string;
}
interface ConversionEventMetadata {
// token metadata for multiple token support
// To be sent with each event if campaign supports multiple tokens
// otherwise default campaign token will be used
conversion?: {
tokenMetadata?: TokenSpec;
};
// To be sent with each event if campaign supports multiple tokens
// otherwise default campaign token will be used
revenue?: {
tokenMetadata?: TokenSpec;
};
}
interface ConversionEvent {
// event name to uniquely identify conversion event
eventName: string;
// public wallet address of the invitee
inviteePublicKey: string;
// The referral code associated with invitee
referralCode?: string;
// revenue value driven by invitee
revenueValue?: number;
// conversion value driven by invitee
conversionValue?: number;
// Conversion event metadata
metadata?: ConversionEventMetadata;
}
Sample cURL
curl --location 'https://us-central1-qwestive-referral-prod.cloudfunctions.net/setConversionEvents' \
--header 'Content-Type: application/json' \
--data '{
"secretApiKey": "/h8+oOoasQJ7zcqKMkyzA0QD9xpNdE7xxiflPzfy0Bs=",
"projectId": "testingProject1234",
"campaignId": "testCampaignId2",
"events": [
{
"eventName": "PLAY_GAME",
"inviteePublicKey": "InviteeNRooBzvZ1WB3UJvQqM8R2CiGcaaEREXMg123",
"revenueValue": 10
},
{
"eventName": "PLAY_GAME",
"inviteePublicKey": "InviteeNRooBzvZ1WB3UJvQqM8R2CiGcaaEREXMg123",
"revenueValue": 30
},
{
"eventName": "PLAY_GAME",
"inviteePublicKey": "InviteeNRooBzvZ1WB3UJvQqM8R2CiGcaaEREXMg124",
"revenueValue": 10,
"conversionValue": 10
},
{
"eventName": "PLAY_GAME",
"inviteePublicKey": "InviteeNRooBzvZ1WB3UJvQqM8R2CiGcaaEREXMg125",
"conversionValue": 5
}
]
}'
FAQs
What is conversionValue?
Conversion value is a metric that is used for tracking campaign performance. We can provide any value that is considered important, we will aggregate that value and provide it per invitee/per referrer/per date and if there is any threshold defined in the campaign settings, we would compare the aggregated conversionValue against that to mark the registered invitee as converted and become eligible for rewards.
What is revenueValue?
Revenue value is another metric that is used for tracking campaign performance. We can provide any value that represents the revenue that we would be making from a user's conversion event.
Last updated