Gameball Developers Guide
v3.0
v3.0
  • Introduction
  • What's New in V3.0
  • Installing Gameball
    • Web
      • Show Gameball Customer Widget
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Go-Live Checklist
    • iOS
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • Android
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
    • React Native
      • Getting Started
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
      • Go-Live Checklist
      • Migration from v1 to v2
    • Flutter
      • Getting Started
      • Initialize Gameball SDK
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Referrals
      • Go-Live Checklist
    • Generic Mobile App
      • Initialize Gameball Customer Profile
      • Track Customer Events
      • Track Orders & Cashback Reward
      • Integrate Redemption
      • Track Referrals
      • Push Notifications
    • Retail & Modern POS
      • Initialize Gameball Customer Profile
      • Track Orders & Cashback Reward
      • Track Refunds
      • Enable Redemption
        • Prepare POS for Redemption
        • Using Virtual ID
          • Using Virtual Card
  • REST API
    • Overview
      • Server-Side SDKs
    • Authentication
    • API Reference
      • Customer
      • Event
      • Transactions
      • Order
      • Coupons
      • Leaderboard 👑
      • Notifications 👑
      • Configurations 👑
      • Batches 👑
        • Batch Operations Data
      • OTP
      • Partner 🤝
        • Client 🤝
        • Redemption Rule 🤝
        • Cashback Rule 🤝
    • Webhooks
      • Notifications Webhook
      • Customer Profile Webhook
    • Errors
    • Object Reference
  • Tutorials
    • Build Custom UI Elements 👑
      • Display Reward Campaign Progress
      • Show VIP Tiers
      • Show Customer Points Balance
      • Build Leaderboards
      • Show Notifications Inbox
      • Adapt UI to Configurations
      • Advanced UI Techniques
        • Increase Sales with Cashback UI Elements
        • Derive Engagement with Rewards Campaigns UI Elements
    • Tracking Customer Events
    • Build your Own Notification System
    • Checkout Integration Example
    • Redemption Integration Options
      • Redeem with coupon system
        • Integrate your coupon system
          • Example using e-commerce platform(WooCommerce)
          • Example using a custom coupon system
        • Build couponing experience
          • Using Gameball widget
          • Build custom experience
            • Showing customers available points
            • Allowing customers to create coupons
            • Apply the discount code to your cart
        • Coupon integration reference
      • Redeem with direct debt
        • Get customers points balance
        • Redeem customer points
  • Third Party Integrations
    • Segment Integration
Powered by GitBook
On this page
  • Introduction
  • Sending Referral
  • Automatic Detection
  • Using Friend Referral Method
  • Firebase Deeplinks Integration
  1. Installing Gameball
  2. iOS

Track Referrals

Reward your customers for referrals and grow your business.

PreviousIntegrate RedemptionNextPush Notifications

Last updated 1 year ago

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 customers' 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 customers.

  2. Invoke referral method with every new account creation through your app.

Tracking referral requires Firebase and Firebase Dynamic Links SDKs installed into your app.

Sending Referral

Referral information can be submitted to Gameball using two methods. The first option involves relying on automatic detection, which is triggered when the register player method is called. Alternatively, you can explicitly use the friend referral. Both approaches yield the desired outcome, and the choice between them depends on your specific scenarios.

Automatic Detection

Using Friend Referral Method

friendReferral should be called after your customer registration, hence a new customer is created. It basically detects if the customer has registered using a referral code or not.

If you need to use a referral method to sign up a new customer using a referral link, call the function below to use the referral module. Best use case is in the success of the registration API of your app.

    let playerAttributes: [String : Any] = [
        "displayName": "John Snow",
        "email": "example@example.com"
    ]
    self.gameballApp?.friendReferral(playerUniqueId:"{layer_unique_id}" , playerAttributes: playerAttributes, completion: { result in
print(result)} )

The playerAttributes is optional, so if you haven't created it yet then call the method like this with only the new playerUniqueId.

    self.gameballApp?.friendReferral(playerUniqueId:"{player_unique_id}", completion: { result in print(result)
    } )

Firebase Deeplinks Integration

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.

1. Firebase configuration

Set up a new Firebase project and install the Dynamic Links SDK into your app. Installing the Dynamic Links SDK allows Firebase to pass along data about the Dynamic Link to the app, including after the user installs the app.

  • Import FireBase in AppDelegate File

import Firebase
  • Copy this code in you AppDelegate

func handleIncommingDynamicLink(_ dynamicLink: DynamicLink){
        guard let url  = dynamicLink.url else {
            return
        }
        self.gameballApp?.recievedDynamicLink(url: url)
    }
    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        if let incommingURL = userActivity.webpageURL {
            let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incommingURL) { (dynamicLink, error) in
                guard error == nil else {
                    return
                }
                if let dynamicLink = dynamicLink {
                    self.handleIncommingDynamicLink(dynamicLink)
                }
            }
            return linkHandled
        }
        return false
    }
    
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url){
            self.handleIncommingDynamicLink(dynamicLink)
            return true
        } else {
            return false
        }
    }

Your customers will be able to get and share their referral link from

After setting up the necessary and adding your Firebase details to Gameball's dashboard, when register player SDK method is called, the system will automatically detect if there is a referral code. If a referral code is found, it will be included in the registration request. This allows the newly registered customer to be linked with the referral code.

Configure Firebase information on your .

Gameball Customer Widget
Gameball's account dashboard
Firebase dependencies