Implementing a Customer Dashboard
A customer dashboard is a crucial component when implementing a referral marketing program. It provides advocates valuable insights into their referral activities, such as the number of referrals and bonuses generated per network. These metrics are critical indicators of the program's effectiveness and help advocates optimize their referral strategies for maximum impact.
<?php
require_once "../vendor/autoload.php";
$contentType = "application/json"; // The content type
$xAuthToken = "2f266b71b8038e674ba"; // Your API Token, you can get your token here https://app.geniusreferrals.com/en/settings/api-access
$accountSlug = 'sandbox';
$client = new GeniusReferralsLib\GeniusReferralsClient($contentType, $xAuthToken);
// 1. Find advocate by email
$advocateEmail = 'john.doe@example.com'; // The referral's email
$advocatesController = $client->getAdvocates();
$advocateResponse = $advocatesController->getAdvocates($accountSlug,1,1, 'email::' . $advocateEmail);
if($advocateResponse->data->total == 1){ // Found the advocate?
$advocate = $advocateResponse->data->results[0];
$reportsController = $client->getReports();
//Getting the bonuses summary per origin
$bonusesSummaryPerOriginResponse = $reportsController->getBonusesSummaryPerOrigin($advocate->token);
$bonusesSummaryPerOrigin = $bonusesSummaryPerOriginResponse->data;
//Getting the referrals summary per origin
$referralsSummaryPerOriginResponse = $reportsController->getReferralsSummaryPerOrigin($advocate->token);
$referralsSummaryPerOrigin = $referralsSummaryPerOriginResponse->data;
}
<?php
require_once "../vendor/autoload.php";
$contentType = "application/json"; // The content type
$xAuthToken = "2f266b71b8038e674ba93b62f928577785c1f45d"; // Your API Token, you can get your token here https://app.geniusreferrals.com/en/settings/api-access
$accountSlug = 'sandbox';
$client = new GeniusReferralsLib\GeniusReferralsClient($contentType, $xAuthToken);
// 1. Find advocate by email
$advocateEmail = 'john.doe@example.com'; // The referral's email
$advocatesController = $client->getAdvocates();
$advocateResponse = $advocatesController->getAdvocates($accountSlug,1,1, 'email::' . $advocateEmail);
if($advocateResponse->data->total == 1){ // Found the advocate?
$advocate = $advocateResponse->data->results[0];
$reportsController = $client->getReports();
//Getting the bonuses summary per origin
$bonusesSummaryPerOriginResponse = $reportsController->getBonusesSummaryPerOrigin($advocate->token);
$bonusesSummaryPerOrigin = $bonusesSummaryPerOriginResponse->data;
//Getting the referrals summary per origin
$referralsSummaryPerOriginResponse = $reportsController->getReferralsSummaryPerOrigin($advocate->token);
$referralsSummaryPerOrigin = $referralsSummaryPerOriginResponse->data;
}
{
"code": 200,
"data": [
{
"amount": 2.50,
"name": "Facebook Share",
"slug": "facebook-share"
},
{
"amount": 5,
"name": "X Post",
"slug": "x-post"
},
{
"amount": 2.50,
"name": "Linkedin Post",
"slug": "linkedin-post"
}
]
}
{
"code": 200,
"data": [
{
"amount": 1,
"name": "Facebook Share",
"slug": "facebook-share"
},
{
"amount": 1,
"name": "X Post",
"slug": "x-post"
},
{
"amount": 1,
"name": "Linkedin Post",
"slug": "linkedin-post"
}
]
}