How Do I Initialize the Customer Profile in the React Native SDK (v4)?
Register customers and show the Gameball profile widget
Initialize Customer (Register/Identify)
Register or update a customer whenever they log in or register in your app.
🔒
Secure API Access: To benefit from v4.1 secure API endpoints, pass the sessionToken parameter when calling methods (required in upcoming SDK v4). This enables automatic routing to v4.1 secure endpoints. Learn more about v4.1 →
Unique identifier for the customer. This should never change for a given customer.
string
Customer’s email address.
string
Customer’s mobile number with country code.
string
Push notification token (required if pushProvider is set).
PushProvider
Push notification provider: PushProvider.firebase or PushProvider.huawei. Required if deviceToken is set.
CustomerAttributes
Additional customer attributes.
string
Referral code if customer was referred by another customer.
boolean
Guest user flag (defaults to false).
string
Optional session token to override the global token for this specific request. Required in upcoming SDK v4.
In React Native SDK, passing a sessionToken parameter updates the global session token. Pass undefined to clear the global token, or omit it to use the current global token.
Validation Rules
InitializeCustomerRequest requires:
customerId cannot be empty or whitespace
If deviceToken is provided, pushProvider must also be specified
If pushProvider is specified, deviceToken must also be provided
CustomerAttributes
Show CustomerAttributes Fields
string
Customer’s display name.
string
Customer’s first name.
string
Customer’s last name.
string
Customer’s email address.
string
Customer’s mobile number.
string
Gender: ‘M’ or ‘F’.
string
Date of birth in YYYY-MM-DD format.
string
Join date in YYYY-MM-DD format.
string
Preferred language code.
Record<string, string>
Custom key-value pairs for additional customer data.
Record<string, string>
Additional key-value pairs for metadata.
Choose an Unchangeable Customer IDThe customerId should be a permanent identifier that will NEVER change. Avoid using email or phone number as the customer ID since these can be updated by users.