Appearance
Custom Properties
Learn how to define and use custom user profile attributes for your specific application needs.
Overview
Beyond the predefined attributes, Upshot.ai allows you to define application-specific custom attributes as part of the user profile. These custom properties enable you to track data that's unique to your business model and user engagement strategy.
Common Use Cases
Custom user profile attributes are perfect for tracking:
Gaming Applications
- Score - Current game score
- Level - Current level in the game
- Achievements - Unlocked achievements or badges
- Experience Points - XP or skill points
- Game Mode Preferences - Preferred difficulty, game modes
- In-Game Currency - Virtual coins, gems, tokens
E-commerce Applications
- Loyalty Points - Reward program points
- Purchase History - Previous purchase categories
- Wishlist Items - Saved items count
- Membership Tier - Bronze, Silver, Gold, Platinum
- Spending Behavior - Average order value, frequency
- Product Preferences - Favorite categories, brands
Content & Media Applications
- Content Preferences - Favorite genres, topics
- Viewing History - Watch time, completed content
- Subscription Status - Free, Premium, Pro user
- Engagement Score - Likes, shares, comments ratio
- Content Creation - Published articles, videos uploaded
Business Applications
- Role - Manager, Employee, Admin
- Department - Sales, Marketing, Engineering
- Permissions Level - Access levels or capabilities
- Usage Metrics - Features used, time spent
- Certification Status - Training completed, licenses
Implementation
objective-c
@import Upshot;
// Gaming app example
// Standard attributes
BKUserInfo *userInfo = [[BKUserInfo alloc] init];
userInfo.email = @"sample@gmail.com";
userInfo.userName = @"userName";
BKExternalId *externalId = [[BKExternalId alloc] init];
externalId.appuID = @"RegistrationId";
userInfo.externalId = externalId;
// Custom gaming attributes
NSDictionary *gamingProfile = @{
@"currentScore": @15420,
@"gameLevel": @25,
@"playerClass": @"Warrior",
@"virtualCurrency": @2500,
@"preferredGameMode": @"Competitive",
@"totalPlayTime": @145.5, // in hours
@"lastPlayedDate": @"2023-12-01"
};
userInfo.others = gamingProfile;
[userInfo buildUserInfoWithCompletionBlock:^(BOOL success, NSError * _Nullable error) {
}];
swift
import Upshot
// Gaming app example
// Standard attributes
let userInfo = BKUserInfo()
userInfo.email = "sample@gmail.com"
userInfo.userName = "userName"
let externalId = BKExternalId()
externalId.appuID = "RegistrationId"
userInfo.externalId = externalId
// Custom gaming attributes
let gamingProfile: [String: Any] = [
"currentScore": 15420,
"gameLevel": 25,
"playerClass": "Warrior",
"virtualCurrency": 2500,
"preferredGameMode": "Competitive",
"totalPlayTime": 145.5, // in hours
"lastPlayedDate": "2023-12-01"
]
userInfo.others = gamingProfile
userInfo.build { (status, error) in
}
Custom Attribute Guidelines
Naming Conventions
Attribute Key Rules
- Start with alphabets: Custom attribute keys must begin with a letter
- Special characters: Only underscore (_) is allowed as a special character
- Invalid characters: SDK will replace other special characters with empty string
- Case sensitivity: Use consistent casing (camelCase recommended)
javascript
// ✅ Good custom attribute keys
const goodKeys = {
userScore: 100,
player_level: 5,
TotalPoints: 1500,
isVIPMember: true,
lastLoginDate: "2023-12-01",
};
// ❌ Bad custom attribute keys (will be cleaned by SDK)
const badKeys = {
"user-score": 100, // Will become userscore
"2ndLevel": 5, // Will become ndLevel
"total@points": 1500, // Will become totalpoints
"is#VIP": true, // Will become isVIP
};