Implementar el Panel de Control para Promotores via SDK
Aprenda a implementar un panel de control para su programa de referidos. Un panel de control efectivo brinda a los promotores una vista detallada de sus referidos y los bonos generados, lo que les permite evaluar la efectividad del programa y ajustar sus estrategias para maximizar sus ganancias. Esta guía le mostrará cómo hacerlo de manera eficiente utilizando nuestro SDK de PHP.
<?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;
}
Paso 4: Mostrar Datos en el Panel de Control
Utiliza los datos obtenidos en la ejecución de los pasos anteriores, para mostrar un resumen en el panel de control de tus promotores. Puedes personalizar el diseño y los elementos visuales según tus necesidades.
<?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;
}
{
"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"
}
]
}