Appearance
User Profile Management
Learn how to manage user profiles and preferences in your app using the Upshot Flutter SDK.
Overview
Every time a user downloads/installs the app and opens it for the first time, the install is tracked and attributed to a new user. This new user is unique in the Upshot.ai universe but could be an existing user of your application who just switched devices or re-installed the app after deleting it or installed the app after resetting the device.
Every user has a set of attributes that can be tracked/set in the application, one of which is the unique id that the application might generate to identify a user in its system. This ID should be set to the AppuID attribute of External IDs in the SDK. This will help track/group all actions performed by a user across multiple devices attributed to one same profile.
Each user profile has one or more named properties that describe that user. Because of rich user data, profiles are excellent for creating audiences to target with personalized messaging.
Default Device/App-Specific Attributes
Upshot.ai sets the following device/app-specific attributes by default:
dart
Device Model
Device OS Version
TimeZone on the device
Network Carrier
TimeZoneDaylight
TimeZoneAbbreviation
IP based location
Latitude (if available)
Longitude (if available)
SystemLocaleCode
BuildVersion
Standard User Profile Attributes
dart
First Name
Middle Name
Last Name
User Name
Language
E-Mail
Occupation
Qualification
Phone
Gender
Marital Status
Age
Location
LocaleCode
Date Of Birth
emailOptout
smsOptout
pushOptout
dataOptout
ipOptout
Facebook ID
Googleplus ID
Gender Values
dart
UpshotGender.male
UpshotGender.female
UpshotGender.other
UpshotGender.reset
Marital Status Values
dart
UpshotMaritalStatus.single
UpshotMaritalStatus.engaged
UpshotMaritalStatus.married
UpshotMaritalStatus.widow
UpshotMaritalStatus.divorced
UpshotMaritalStatus.reset
Custom User Profile Attributes
Upshot.ai defines some standard attributes for each user and also allows you to define application specific custom attributes as part of the user profile. SDK will discard any key which doesn't follow the naming convention.
Examples of Custom Attributes:
- Score
- Level in the game
- Loyalty Points
- Status info or badges like "Power user", "Novice user", "Gold Member", etc
Important
• Naming Convention for Custom Attributes Keys: Special characters won't be allowed except underscore (_). Keys should start with alphabets only. • String attribute values length should be less than 64 chars.
Setting User Profile
Set user profile information using Flutter methods:
dart
// Define user profile attributes
Map<dynamic, dynamic> profileAttributes = {
UpshotProfileAttributes.userName: "Name of the user",
UpshotProfileAttributes.email: "email@example.com",
UpshotProfileAttributes.gender: UpshotGender.male,
UpshotProfileAttributes.age: 25,
UpshotProfileAttributes.phone: "+919999999999",
UpshotProfileAttributes.appuID: "RegistrationID",
// Custom attributes
"Score": 100,
"Level": 1,
"membership_tier": "Gold"
};
// Set user profile
FlutterUpshotPlugin.sendUserDetails(profileAttributes);
User Profile Update Status:
Listen for ProfileUpdate status :
dart
// Authentication status callback
static const _channel = MethodChannel('flutter_upshot_plugin');
UpshotMethodChannel() {
_channel.setMethodCallHandler (_methodCallHandler);
}
Future <dynamic>_methodCallHandler(MethodCall call) async {
bool status = call.arguments as bool;
if (call.method == 'upshotProfileUpdatingStatus') {
}
}
User Logout
Whenever a user logs out, the app should inform Upshot.ai that the user has logged out:
dart
Map profileAttributes = { UpshotProfileAttributes.appuID: "" };
FlutterUpshotPlugin.sendUserDetails(profileAttributes);
Get User ID
This method returns the userID/deviceID generated by Upshot.ai:
dart
String? userId = await FlutterUpshotPlugin.upshotUserId();
Important Notes & Validation
Validation Rules
- Phone Numbers: Must start with + and contain only numeric values (Ex: +9999999999). SDK will discard numbers that don't follow this pattern.
- String Fields: Maximum 64 characters for value type string fields like firstName, lastName, userName, etc.
- Custom Attribute Keys: Special characters won't be allowed except underscore (_). Keys should start with alphabets only. SDK will replace special characters with empty string.
Best Practices
- Consistent Data Format: Always use consistent data formats for dates, phone numbers, and other structured data
- Privacy Compliance: Respect user privacy settings and opt-out preferences
- Data Validation: Validate user input before sending to Upshot.ai
- Regular Updates: Keep user profiles updated as user information changes
- Custom Attributes: Use meaningful names for custom attributes that align with your business logic
- Method Channel: Set up proper method channel handling for callbacks
Validation in Dashboard
You can validate UserProfile data in the Dashboard Live Events section to ensure the data is being captured correctly.