Custom Properties
Bring your own data to the party!
You can add your own custom properties for use in the conditional targeting system. Adding more data about your users/app can provide more powerful options for targeting and optimization.
Well Known vs Custom Properties
There are two types of custom properties:
Well known properties: A set of properties we define, and you set. These are common things that most apps have like "user_signup_date". By using this well known set, our optimization system can incorporate these properties (when provided) and make smarter optimization decisions. We suggest you set as many of these that make sense for your app's user experience.
Custom properties can be any key/value pairs which you might find useful for targeting
Well Known Property List
user_signup_date
datetime (NSDate)
The timestamp of when this user signed up for your app/service.
user_signed_in
bool
Is the user signed into an account
have_user_email
bool
Do we have an email address tied to this user's account.
user_email_validated
bool
Has the user validated their email, confirming they own it.
have_user_phone
bool
Do we have phone number tied to this user's account.
user_age
int
The user's exact age, in years. Use user_approx_age if you only know the approximate age of the user.
user_approx_age
int
The user's approximate age, in years. Use user_age if you know the exact age of the user.
user_pronouns
string
The user's preferred pronouns. Example: she_her, he_him, they_them, other, declined_to_say
user_gender
string
The user's gender. Examples: male, female, nonbinary, declined_to_say.
user_inferred_gender
string
The user's gender, if inferred and not user specified.
has_paid_subscription
bool
Does this user have a paid subscription.
ever_subscribed
bool
True if the user has ever been a paid subscriber, even if they no longer currently subscribe.
has_purchased
bool
Has the user ever made a purchase.
purchase_count
int
Count of all purchases made.
total_purchase_value
float
Total purchase value (excluding subscriptions), this user had made. Unit/currency is up to you, but should be consistent for all users.
referral_source
string
The name of how this user was referred to your app (fb_ad, google_ad, organic, search, user_referral, etc).
referral_id
string
An ID relating to the referral source (example: campaign ID)
user_was_referred
bool
Was this user referred by another user?
user_referral_count
int
How many users has this user referred.
session_source
string
How did the user launch the app for this app session? Examples: deeplink, notification, manual_launch, email_link, web_link, etc.
Setting Properties in Code
You can set properties in code using the following functions of the CriticalMoments.sharedInstance
object.
Ideally set properties before calling start
on CriticalMoments. Some events like app_start
occur very early, and you'll want properties to be available.
If your properties are async, consider firing an app_loaded
event after setting them, which you can use as a trigger for conditions requiring them.
Setting Many Properties via JSON
You can set a set of properties from JSON formatted data. This can be very helpful, allowing your to add properties to shipping clients without updating the app.
Properties must be set before calling [CriticalMoments.sharedInstance start]
. Properties set after calling start will be ignored.
Generally this API is used like follows:
You create a server endpoint (for example
/user_properties
), which is authenticated and retrieves information about this user in JSON format.Call this server API on launch, and then pass the resulting JSON to
registerPropertiesFromJson
Optionally cache this result for faster startup (used cache results on launch, refresh cache for next launch).
Last updated