HomeAppVirality DocsAdvanced ConfigurationsCustomizing Referral Code

Customizing Referral Code

The test app provided with the AppVirality SDK 2.0 has a pre-implemented feature that allows users to modify/customize their Referral Code. This sort of personalization is the current fashion when it comes to Referral Codes.

How can a User Modify/Customize Referral Code
The Referral Code customization can be added as a standalone feature for your Referral program too, as and wherever you please.

As described above, make sure you have a field to receive the new custom Referral Code.

After the user enters the Referral Code and commits to customize it (by a click action on a Button like Save etc.), send the newly entered Referral Code to the AppVirality SDK through the below mentioned method:

  appVirality.customizeReferralCode(newReferralCode, new AppVirality.CustomizeRefCodeListener() {
   public void onCustomRefCodeSet(boolean isSuccess, String errorMsg) {
       try {
           if (isSuccess) {
               // Referral Code changed successfully. Update the same in your
               // local campaign details instance.
           } else {
               // Referral Code couldn't be changed, check errorMsg to know
               // the cause of failure.
       } catch (Exception e) {


Important Note:

Please ensure that the newly entered Referral Code is not more than 10 characters long.
It could help to alert the user about the 10 character limit when the user engages in this activity 

Note that in the above code block we advise you to update the newly obtained Referral Code in your local campaign instance.


Once updated, the new referral code is the de facto Referral identifier for the user. Any instances of the old referral code shall become irrelevant.

So if someone clicks on an old referral link or uses the old Referral code to sign-up, their Referral linkage would fail and hence the new user would not receive rewards. Make sure you handle this use case with appropriate error handling.


Was this article helpful to you? Yes No