Initialize Gameball Customer Profile

Show your customers' profile including all details and progress on your Flutter app.

Showing the Gameball widget on your mobile application is slightly different than showing it on the website. You have two options; first, if you want to design your customer interface, you will use our set of REST APIs. To know more information, you can follow this guide. The other option as this section elaborates, is through using our Flutter SDK.

Using the SDK, you can open the Gameball customer profile from a button in your app, programmatically when someone does something, or from a persistent button that sits over your appโ€™s UI.

When you trigger the Gameball customer profile, your customer is presented with a home screen. This is configurable inside Gameball to change how it looks and whatโ€™s presented.

From there, your customer can check his progress across different Gameball programs as per your configurations.

Gameballโ€™s views are accessible through the code below. You just need to use it on any button action.

// If you want to create/Update Player just create 
//Send with from string then convert it to json or create a json and sent it directly

let playerAttributesString =  '''
{
  "playerUniqueId": <PLAYER_ID>,
  "mobile": "+1234567",
  "email": "jon.snow@example.com",
  "playerAttributes": {
    "displayName": "Jon Snow",
  },
  "referrerCode": null,
  "levelOrder": null
}
''';

 final Map<String, dynamic> playerData = jsonDecode(playerDataString);
     apiKey: <YOUR_API_KEY>,
     playerUniqueId: <YOUR_PLAYER_UNIQUE_ID>,
     lang: 'en',
     playerAttributes: playerData ,
     platform: <YOUR_PLATFORM>,
     shop: <YOUR_SHOP>
   );
 

// In your widget just path thr context for the sdk like 
 gameball.openGameballView(context);
   
   
   

Once the APIKey and playerUniqueId have been registered, Gameball views can be made visible to the customer.

The below is description of Initialization params

Parameter

Type

Required

Description

APIKey

string

Yes

Client API key

playerUniqueId

string

Yes

Unique identifier for the customer in your database.

Could be database ID, random string, email or anything that uniquely identifies the customer.

lang

string

No

Your platform language preference to view Gameball Widget with.

Note: The language provided should be as per configured languages in your account.

Example: "en", "fr".

playerAttributes

string

No

PlayerAttributes is a builder class with set of properties that you want to set for the customer.

platform

string

No

Your platform

shop

string

No

Your Shop

Everytime the Gameball View is initialized with a new PlayerUniqueId , the customer profile is created or updated at Gameball side. You may consider enriching your Gameball's customer profile with attributes that are not avialable to the UI by using server-side Create\Update Customer API

Choose an Unchangeable Player Unique ID

Gameball customer gets created using theplayerUniqueId. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given customer, you risk losing all original data for that customer, hence losing their points and rewards on Gameball. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the customer at anytime.

Last updated