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
  • Integration Steps
  • Integration Details
  1. Installing Gameball
  2. React Native

Track Referrals

Reward your customers for referrals and grow your business.

PreviousIntegrate RedemptionNextPush Notifications

Last updated 5 months ago

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

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

Below is a step by step guide on how to listen to referral registration and notify Gameball to track and reward.

  1. First, you'll need to set up Firebase within your mobile app.

  2. After setting Firebase deep links 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 {
    return
  }

  // Locate the GBReferral parameter
  if let gbReferral = queryItems.first(where: { $0.name == "GBReferral" })?.value {
    // Track the referral in your Gameball account
    // ...
import dynamicLinks from '@react-native-firebase/dynamic-links';

dynamicLinks()
  .onLink((link) => {
    if (link.url) {
      const urlParams = new URLSearchParams(link.url.split('?')[1]);
      const gbReferral = urlParams.get('GBReferral');
      if (gbReferral) {
        // Track the referral in your Gameball account
        console.log('GBReferral:', gbReferral);
      }
    }
  })
  .catch((error) => console.error('Dynamic Link error:', error));

You have full flexibility to choose Firebase dependency packages to be used for dynamic link extraction while keeping Gameball SDK focused solely on Gameball

GameballSDK.registerPlayer({
  playerUniqueId: "{CUST_ID}",
  deviceToken: "{deviceToke}",
  referrerCode: "{referrerCode}",
  playerAttributes: {
    displayName: "{displayName}",
    firstName: "{firstName}",
    lastName: "{lastName}",
    //other attributes
  },
})

Once you have located the GBReferral parameter within a dynamic link. You will need to send its value and send along with the SDK call that is being executed for the newly created referred customer.

Gameball Customer Widget
registerPlayer