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.

Prerequisites

  • Platform Registration: Sign up on Genius Referrals and obtain your API credentials.
  • Genius Referrals SDK: Ensure you have installed the Genius Referrals SDK for PHP.
Example Use Case: Showcasing Referral Metrics
Let’s explore how the customer dashboard effectively showcases referral metrics using two distinct referral program design templates. If you’d like to see more template options, visit the Referral Program Templates page.
Step 1: Client Configuration
Client Initialization

<?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);



Step 2: Finding the Advocate
To retrieve the advocate, ensure that your advocates are authenticated in the system and use their email to search for them.

// 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);

Step 3: Retrieving Bonus and Referral Summaries
Use the getBonusesSummaryPerOrigin and getReferralsSummaryPerOrigin methods from the SDK to get the total bonuses and referrals generated by an advocate by the network. The reportsController also includes other reports that are available to you.

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;
}

Step 4: Display Data on the Dashboard

Use the data obtained from the previous steps to display a summary on your advocates' dashboard. You can customize the design and visual elements according to your needs.
Note: Implementing a dashboard using the Genius Referrals SDK allows your advocates to view their bonuses and referrals by network. This helps them adjust their strategies and increase their earnings in the referral program.
Complete Code Example
Here is an example of the complete code:

<?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;
}
Example of getBonusesSummaryPerOrigin Method Response
Here is an example of the response in JSON format:

{
    "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"
        }
    ]
}

Response Example for the getReferralsSummaryPerOrigin Method
Here is an example of the response in JSON format.

 {
    "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"
        }
    ]
}
¿Fue útil esta página?
LANGUAGE