How to Capture New Referrals on my App

Once one of your advocate's shares a link (using your share links page) their friends will click on the content, that was published on one of the networks, and will be redirected back to your Website to the landing URL that you've defined in your Widgets Package. At this point you need to be able to capture the new referral by getting the parameters from the query string and saving the new referral on the Genius Referrals Platform using one of our SDKs or the RESTful API.

For capturing a new referrals you need to extract the following parameters that were included in your landing URL, the parameters are: 

  • gr_at: will store the advocate referrer token
  • gr_cs: will store the campaign slug 
  • gr_ro: will store the referral origin slug

Here is a simple example that you can use to get the parameters in your landingURLAction(...):

Example using the PHP SDK: 

/*
 * On your action method just do something like this
 */

$strGRAdvocateReferrerToken      = $_GET['gr_at']; 
$strGRCampaignSlug               = $_GET['gr_cs'];
$strGRReferralOriginSlug         = $_GET['gr_ro'];

$_SESSION['strGRAdvocateReferrerToken'] = $strGRAdvocateReferrerToken;
$_SESSION['strGRCampaignSlug']          = $strGRCampaignSlug;    
$_SESSION['strGRReferralOriginSlug']    = $strGRReferralOriginSlug; 

The final step is to created the connection between the new customer (a lead) and his referrer (the advocate that shared the link). This should be done after the lead has finished the signup process because chances are that the lead will never sign up for your services. So you have to save the variables $strGRAdvocateReferrerToken$strGRCampaignSlug and $strGRReferralOriginSlug somewhere (a session in PHP for example) and once the lead has finished the signup process (and we have registered the advocate in the Genius Referrals Platform) you can create the new referral for the referrer advocate that has shared the link. Here is the example.

Example using the PHP SDK:  

    /*
     * On your action method just do something like this
     */

    //loading parameter from session
    $strGRAdvocateReferrerToken  = $_SESSION['strGRAdvocateReferrerToken']; 
    $strGRCampaignSlug           = $_SESSION['strGRCampaignSlug'];
    $strGRReferralOriginSlug     = $_SESSION['strGRReferralOriginSlug'];

    // Create a new GRPHPAPIClient object
    $objGeniusReferralsAPIClient = new GRPHPAPIClient('YOUR_USERNAME', 'YOUR_API_TOKEN');
    $arrParams = array(
        'referral' => array(
            'referred_advocate_token' => $strGRNewAdovocateToken, //the one create when the advocate was registered. 
            'referral_origin_slug'    => $strGRReferralOriginSlug,
            'campaign_slug'           => $strGRCampaignSlug, 
            'http_referer'            => $_SERVER['HTTP_REFERER']  
        )
    ); 
    $objGeniusReferralsAPIClient->postReferral('genius-referrals', $strGRAdvocateReferrerToken, $arrParams); 
    $intResponseCode = $objGeniusReferralsAPIClient->getResponseCode();
    if($intResponseCode == 201){ 
        //if susccessfully created move on
    }
    else{
        //handle errors
    }




Resource Extension Size



Please leave your comments/questions below