Skip to main content

Display the Profile Widget

The Gameball profile widget shows customer points, tiers, achievements, leaderboards, available rewards, and full loyalty activity—all inside a native in-app experience. Use this when the customer taps Rewards, My Points, Loyalty, or any entry point that should open their Gameball profile.

Basic Usage

🔒
Secure API Access: To benefit from v4.1 secure API endpoints, pass the sessionToken parameter when showing the profile widget (required in upcoming SDK v4). This enables automatic routing to v4.1 secure endpoints. Learn more about v4.1 →

Request Parameters

String
Unique permanent identifier of the customer whose profile you want to display. Optional in v3.1.1 (omit for guest mode).
String
Opens a specific widget section (e.g., "details_earn", "details_redeem").
Defaults to the main profile view.
Bool
Hides the widget’s navigation bar. Defaults to false.
Bool
Displays a floating close button. Defaults to false.
String
Hex value (e.g., "#FF5733") for close button color. Only used when showCloseButton = true. Defaults to #CECECE.
From v3.2.1 the close button is drawn as a vector and tinted with this color, so it stays crisp at any screen scale.
String
Optional per-request session token. Overrides the global SDK token. Required in upcoming SDK v4.
String
Customer mobile number, used for channel merging. Available from v3.2.0.
String
Customer email address, used for channel merging. Available from v3.2.0.
Handler for links the widget tags with gbExternalBrowser=true. When provided, the link is delegated to your app; otherwise the SDK opens it in the system browser. Available from v3.2.0.
(([String: Any]?) -> Void)
Receives events the widget posts, such as game completion. Available from v3.2.0.

Validation Rules

  • No validation for customerId (guest mode is allowed). Provide customerId for authenticated profiles.

Advanced Configuration

Open a Specific Section


Guest Mode (v3.1.1+)


Custom Close Button


Hide Navigation

Best used with openDetail to guide users directly to a specific section when navigation is hidden.

Links the widget tags with gbExternalBrowser=true open in the system browser by default. Provide an externalLinkCallback to handle them yourself instead (for example, to open an in-app browser or route to a custom screen):
When externalLinkCallback is set, the SDK delegates the link to your app and does not open the system browser.

Channel Merging (v3.2.0+)

Pass the customer’s mobile and email so Gameball can merge the customer’s channels:

Widget Events (v3.2.0+)

Pass a widgetEventCallback to react to events the widget posts, such as a customer finishing a game. Each event arrives as a [String: Any] dictionary with a top-level type and a nested metadata dictionary:

gameCompleted Metadata

All gameCompleted values arrive as String or Bool. There are no numeric fields.

Dismiss the Widget (v3.2.0+)

Dismiss the widget programmatically from your app. The call is a no-op when no widget is showing:
The widget can also dismiss itself from the web side by calling window.GameballWidget.closeWidget().

Implementation Examples

UIKit — Button Action


SwiftUI Integration


Tab Bar Integration


Widget Content

Customer Info

Points balance, tier, progress, and personal details

Reward Campaigns

Available rewards, challenges, badges, and earning opportunities

Leaderboard

Ranking, competition, and top performers

Transaction History

Full breakdown of points earned and redeemed
All widget themes, layout options, and branding styles can be customized from the Gameball Dashboard.

Best Practices

1

Make It Discoverable

Add the profile entry point in a visible place (e.g. tab bar, profile screen, side menu).
2

Use Notification Badges

Indicate new rewards or achievements to drive engagement.
3

Deep Link Intelligently

Use openDetail to open specific sections after qualifying user actions (e.g., after earning points).
4

Handle Errors Gracefully

Always provide fallback UI or messaging for network interruptions.
Showing the profile widget right after a reward is earned significantly boosts customer engagement.