AdColonyUserMetadata Class Reference
Inherits from | NSObject |
---|---|
Declared in | AdColonyUserMetadata.h |
Overview
AdColonyUserMetadata objects are used to provide AdColony with per-user, non-personally-identifiable information for ad targeting purposes. Note that providing non-personally-identifiable information using this API will improve targeting and unlock improved earnings for your app.
Pre-defined Aspects of User Metadata
userAge
Configures the user’s age.
@property (nonatomic) NSInteger userAge
Discussion
Set this property to configure the user’s age.
Declared In
AdColonyUserMetadata.h
userInterests
Configures the user’s interests.
@property (nonatomic, strong, nullable) NSArray<NSString*> *userInterests
Discussion
Set this property with an array of NSStrings to configure the user’s interests.
Declared In
AdColonyUserMetadata.h
userGender
Configures the user’s gender.
@property (nonatomic, strong, nullable) NSString *userGender
Discussion
Set this property to configure the user’s gender. Note that you should use one of the pre-defined constants below to configure this property.
Declared In
AdColonyUserMetadata.h
userLatitude
Configures the user’s latitude.
@property (nonatomic, strong, nullable) NSNumber *userLatitude
Discussion
Set this property to configure the user’s latitude.
Declared In
AdColonyUserMetadata.h
userLongitude
Configures the user’s longitude.
@property (nonatomic, strong, nullable) NSNumber *userLongitude
Discussion
Set this property to configure the user’s longitude.
Declared In
AdColonyUserMetadata.h
userZipCode
Configures the user’s zip code.
@property (nonatomic, strong, nullable) NSString *userZipCode
Discussion
Set this property to configure the user’s zip code.
Declared In
AdColonyUserMetadata.h
userHouseholdIncome
Configures the user’s household income.
@property (nonatomic, strong, nullable) NSNumber *userHouseholdIncome
Discussion
Set this property to configure the user’s household income.
Declared In
AdColonyUserMetadata.h
userMaritalStatus
Configures the user’s marital status.
@property (nonatomic, strong, nullable) NSString *userMaritalStatus
Discussion
Set this property to configure the user’s marital status. Note that you should use one of the pre-defined constants below to configure this property.
Declared In
AdColonyUserMetadata.h
userEducationLevel
Configures the user’s education level.
@property (nonatomic, strong, nullable) NSString *userEducationLevel
Discussion
Set this property to configure the user’s education level. Note that you should use one of the pre-defined constants below to configure this property.
Declared In
AdColonyUserMetadata.h
Setting Arbitrary Metadata
– setMetadataWithKey:andStringValue:
Configures the AdColonyUserMetadata object with the given key/value pair.
- (BOOL)setMetadataWithKey:(NSString *)key andStringValue:(NSString *)value
Parameters
key |
A key to represent the metadata. Must be 128 chars or less. |
---|---|
value |
An NSString used to configure the metadata. Must be 128 chars or less. |
Return Value
Whether the option was set successfully.
Discussion
Use this method to send arbitrary user metadata.
Declared In
AdColonyUserMetadata.h
– setMetadataWithKey:andNumericValue:
Configures the AdColonyUserMetadata object with the given key/value pair.
- (BOOL)setMetadataWithKey:(NSString *)key andNumericValue:(NSNumber *)value
Parameters
key |
A key to represent the metadata. |
---|---|
value |
An NSNumber used to configure the metadata option. |
Return Value
Whether the option was set successfully.
Discussion
Call this method with one of the keys defined below and pass an NSNumber for the value. Use this method for configuring the user’s age, household income, and location.
Declared In
AdColonyUserMetadata.h
– setMetadataWithKey:andArrayValue:
Configures the AdColonyUserMetadata object with the given key/value pair.
- (BOOL)setMetadataWithKey:(NSString *)key andArrayValue:(NSArray<NSString*> *)value
Parameters
key |
A key to represent the metadata. |
---|---|
value |
An NSArray containing NSStrings used to configure the metadata option. Strings must be 128 chars or less. |
Return Value
Whether the option was set successfully.
Discussion
Call this method with one of the keys defined below and pass an NSArray for the value. Currently, this method should only be used to configure a set of user interests. Note that the array must only contain NSStrings.
Declared In
AdColonyUserMetadata.h
Metadata Retrieval
– getStringMetadataWithKey:
Returns the string value associated with the given key in the metadata object.
- (nullable NSString *)getStringMetadataWithKey:(NSString *)key
Parameters
key |
The key representing the metadata. |
---|
Return Value
The value associated with the given key. Returns nil
if the value has not been set.
Discussion
Call this method using the string-based key representing the metadata option to obtain the corresponding sring-based value.
Declared In
AdColonyUserMetadata.h
– getNumericMetadataWithKey:
Returns the numeric value associated with the given key in the metadata object.
- (nullable NSNumber *)getNumericMetadataWithKey:(NSString *)key
Parameters
key |
The key representing the metadata. |
---|
Return Value
The value associated with the given key. Returns nil
if the value has not been set.
Discussion
Call this method using the string-based key representing the metadata option to obtain the corresponding numerical value.
Declared In
AdColonyUserMetadata.h
– getArrayMetadataWithKey:
Returns the array value associated with the given key in the metadata object.
- (nullable NSArray *)getArrayMetadataWithKey:(NSString *)key
Parameters
key |
The key representing the metadata. |
---|
Return Value
The value associated with the given key. Returns nil
if the value has not been set.
Discussion
Call this method using the string-based key representing the metadata option to obtain the corresponding array value. Currently, this method should only be used to retrive a set of user interests.
Declared In
AdColonyUserMetadata.h