Deep LinkingReferralsTechnical

How to Set Up Rewards for Referrals of Referrals

By September 1, 2016 No Comments

Branch’s Referral Reward system was designed to give you the power to incentivize users to refer others to your app by allowing you to reward them for their referrals. According to Nielsen, 77% of consumers are more likely to buy a new product when learning about it from friends or family, so it makes sense that referrals should be a part of your growth strategy.For example, with Branch, you can set up Reward Rules so that when User A – who has been invited to the app with a Branch link from User B  – runs the app for the first time, User B gets some kind of reward. Pretty great, right?

Simply bringing a user to the app is all well and good, but how valuable is that referred user? If all they do is install the app and then forget about it, then not very valuable. But shouldn’t User B also be rewarded when User A engages with your app in some meaningful way? A Reward Rule can be set up to reward User A when User B purchases something within your app for the first time. Similarly, a Reward Rule can be used so that when, for instance, User A reads their 10th piece of content, User B gets rewarded. There are all sorts of use-cases for Reward Rules to incentivize your users to bring in high-value users to your app. But what if you wanted to also reward a user when someone they’ve driven to the app drives others to the app?

For example, if User A from the above example were to invite another user, User C to the app, you can set up Reward Rules to reward User A  when User C installs, but Reward Rules only affect the referring and referred users. There’s no way for User B, the original referrer, to be rewarded for User A’s referral, is there?

Au contraire. Here is a recipe to do just that.

Setting Up Referrals of Referrals

What you will need:

  • 3 Reward Rules
  • 2 Custom In-app Events
  • 2 Forms of Currency

Reward Rule 1

Referring users get 10 default credits the first time users they’ve referred trigger the event installAfterReferral

The first Reward Rule should look pretty familiar, as it’s a standard setup to give a referring user some credits when they get someone new to install your app.* This rule will reward User A with 10 credits when User C (whom she invited to the app) fires the “installAfterReferral” event. And how does that happen?

* Branch doesn’t merge identities, so if you trigger rewards on open or install, there could be lost or duplicated rewards for your users.

Custom Event 1

Android

JSONObject params = Branch.getInstance().getFirstReferringParams();

if ((params.has(“+clicked_branch_link”)) && (params.getBoolean(“+clicked_branch_link”)))
   Branch.getInstance(getApplicationContext()).userCompletedAction(“installAfterReferral”);

iOS

NSDictionary *params = [[Branch getInstance] getFirstReferringParams];

if (([params objectForKey:@”+clicked_branch_link”]) && ([[params objectForKey:@”+clicked_branch_link”] boolValue]))
    [[Branch getInstance] userCompletedAction:@”installAfterReferral”]

The above code block will trigger the event “installAfterReferral” if the user clicked a Branch link to install the app. This will in turn trigger the first Reward Rule for the referring user. If you’re using setIdentity to identify your users, this block should appear shortly after that.

Reward Rule 2

Referring users get 1 referralToken credit the first time users they’ve referred trigger the event installAfterReferral

This looks almost exactly like the first Reward Rule, just with a different type of credit. Now, if User A refers User C to the app, and User C  triggers the “installAfterReferral” event, User A  will be awarded 10 default credits and 1 referralToken. But the default credits are what we use to actually give User A in-app rewards, so what do we do with the referralTokens?

Custom Event 2

Android

Branch.getInstance(getApplicationContext()).loadRewards(new BranchReferralStateChangedListener() {
    @Override
    public void onStateChanged(boolean changed, Branch.BranchError error) {
        if (error == null) {
            String referralRewardBucket = “referralToken”;
            int referralCredits = Branch.getInstance(getApplicationContext()).getCreditsForBucket(referralRewardBucket);
            
            while (referralCredits-- > 0) {
                Branch.getInstance(getApplicationContext()).redeemRewards(1, referralRewardBucket, new BranchReferralStateChangedListener() {
                @Override
                public void onStateChanged(boolean isChanged, Branch.BranchError err) {
                    Branch.getInstance(getApplicationContext()).userCompletedAction(“redeemReferralToken”);
                });
            }
        }
    }
});

 iOS

[[Branch getInstance] loadRewardsWithCallback: ^(BOOL changed, NSError *error) {
    if (!error) {
        NSString *referralRewardBucket = @”referralToken”;
        int referralCredits = [[Branch getInstance] getCreditsForBucket: referralRewardBucket];

        while (referralCredits-- > 0) {
            [[Branch getInstance] redeemRewards:1 forBucket:referralRewardBucket callback: ^(BOOL chng, NSError *err) {
                [[Branch getInstance] userCompletedAction:@”redeemReferralToken”];
            }];
        }
    }
}];

This code block (which should probably be performed once per session for the user) will observe the user’s current credit balance with Branch. If they have any referralTokens in their account, it will attempt to redeem each one, triggering the event “redeemReferralToken” for each successful redemption.

So, that’s what the referralToken credits are for, but what does the redeemReferralToken event do?

Reward Rule 3

Referring users get 5 default credits each time users they’ve referred trigger the event redeemReferralToken

This is the money maker rule, otherwise known as a credit-maker. That referralToken that User A was given from Reward Rule 2 will now be redeemed automatically when she launches the app, and User B gets 5 credits for each of those redemptions.

So the full flow is: User B invites User A to the app and is rewarded for that with 10 credits. (Reward Rule #1) User A then invites User C to the app and is rewarded with 10 credits. (Reward Rule #1) User A also gets a referralToken credit for inviting User C. (Reward Rule #2) User A’s referralToken gets redeemed the next time they launch the app, giving User B an additional 5 credits for his part in driving User C to the app. (Reward Rule #3)

Now you have second-order referral rewards!

The number of credits awarded for the referrals (both first- and second-order) can be changed, of course, and the concept could even be extended to reward User B for just about any other event that User C performs (firstTransaction, tenArticlesViewed, etc.). All that is required is another “token” type of currency which gets awarded to the referring user, which is then automatically redeemed by that user in the same way as the referralRewardToken, thereby rewarding their referring user.

This is a recipe that will expand your referral reward program to better incentivize your organic growth, something all apps need to succeed.