Track Referrals
Reward your players for referrals and grow your business

Introduction

One of the most effective ways to get new users is through user referrals. You can use Gameball referrals capabilities to encourage your users to invite their friends by offering rewards for successful referrals to both the referrer and the recipient.
Gameball referrals uses Firebase Dynamic Links in the background to generate players referral links and track referrals. Dynamic Links are smart URLs (deep links) that survive the app install process, so new referred users via referral links will be easily tracked when they open the app for the first time.
Gameball and its SDK provides hassle free integration to track referrals where you will only need to
    1.
    Provide your firebase info through Gameball dashboard to generate referral links to your players
    2.
    Invoke referral method with every new account creation through your app.
Your players will be able to get and share their referral link from Gameball Player Widget
Tracking referral requires Firebase and Firebase Dynamic Links SDKs installed into your app.

Integration Steps

To integrate and track referrals you need to perform two main steps
    1.
    Configure your Firebase dynamic links settings from your firebase console
    2.
    Configure Firebase on your App and Gameball account dashboard
    3.
    Invoke SDK Referral method within your App user registration flow

Integration Details

For dynamic links you can use react-native firebase package and follow the steps of dynamic links initialization. To get the initial link that is used to start the app, use:
1
let initialLink = await firebase.links().getInitialLink();
Copied!
If there is a link, call the getReferralCode function and pass the URL as a parameter:
1
let referralCode = GameballSdk.getReferralCode(initialLink);
Copied!
After this, call addReferral function:
1
GameballSdk.addReferral({
2
"playerCode": referralCode,
3
"playerUniqueId": playerId,
4
"deviceToken": await AsyncStorage.getItem('push_token'),
5
"osType": Platform.OS === 'ios' ? 'ios' : 'android',
6
"playerAttributes": {
7
"displayName": displayName,
8
"email": email,
9
"gender": gender,
10
"mobileNumber": mobileNumber,
11
"dateOfBirth": dateOfBirth,
12
"joinDate": new Date(),
13
}
14
})).then(response => console.log(response)) // on success
15
.catch(error => console.log(error)) // on error
Copied!
Parameter
Required
Description
Type
playerCode
Required
referralCode extracted from the link
String
playerUniqueId
Required
player ID is a unique ID for you user. (eg. user email, UUID,.. etc.). The playerId is to be provided by the client and must be unique for each user.
String
playerTypeId
Optional
Each player type has an ID
Integer
playerAttributes
Optional
PlayerAttributes is a builder class which is used to add or update your player info to Gameball. Player object is described in Object Reference section.
Object
deviceToken
Optional
Mobile device token used for push notifications
String
osType
Optional
Operating system of the device running the application
String
Now, referral links will be generated successfully for your players!
Last modified 1mo ago