Comment on page

Track Referrals

Reward your players for referrals and grow your business
Gameball uses Firebase to generate dynamic links to support referrals. Hence Firebase dependency must be used in your mobile app
Before you start, you must configure your Firebase on your Gameball account. Follow the steps in Configure your Firebase account on Gameball for mobile friends referral links article in our Help Center to configure your Firebase account on Gameball.
Dynamic Links are smart URLs that allow you to send existing and potential users to any location within your app. They survive the app install process, so even new users see the content they're looking for when they open the app for the first time.
Once you've configured Firebase within your Gameball dashboard, Gameball will automatically create a unique referral link for each player. This referral link includes the player's unique referral code and can be shared with friends to refer them to your mobile app.
This referral link is generated dynamically and can be accessed via Gameball profile widget. It can also be accessed programmatically using the Gameball Get Player API within its response as below snippet.
Depending on your desired experience. You can choose to show the referral link within profile page within your app so the users can locate it and share it within their network.
Now that you have allowed your user locate and share their referral links. Below is a step by step guide on how to listen to referral registration and notify Gameball to track and reward.
  1. 1.
    First, you'll need to set up Firebase within your mobile app.
  2. 2.
    After setting Firebase within your app and configuring Firebase from Gameball's dashboard, you'll need to listen to deep links query parameters within your app. When a user clicks on a Firebase Dynamic Link that includes the GBReferral parameter, the GBReferral parameter will be included in the deep link query parameters. This parameter contains the referral information that you'll need to send to Gameball to track referrals.
Here's an example of how you can listen to deep links query parameters and locate the GBReferral parameter in your mobile app:
// Listen for incoming Firebase Dynamic Links
Firebase.dynamicLinks().getDynamicLink { (dynamicLink, error) in
guard let dynamicLink = dynamicLink,
let deepLink = dynamicLink.url,
let queryItems = URLComponents(url: deepLink, resolvingAgainstBaseURL: true)?.queryItems else {
// Locate the GBReferral parameter
if let gbReferral = queryItems.first(where: { $ == "GBReferral" })?.value {
// Track the referral in your Gameball account
// ...
Once you have located the GBReferral parameter within a dynamic link. You will need to send its value and send along with the Create Player API that is being executed for the newly created referred player.
The below sample body for the Create Player API creates a new player with player unique id {referred_player_id} that has been referred by the player who owns the code of 001122 captured form the dynamic link
"referrerCode": "001122",