Comment on page
iOS User
Use
NetmeraUser
class to send information about your application's users to Netmera in a structured way.Typical place to inform Netmera about application user's attributes is after your users has logged in to your application.
After you have information about your user, you should create a
NetmeraUser
object, set values, then call [Netmera updateUser:]
method like below.Swift
Objective-C
// Set user's properties
let user = NetmeraUser()
user.userId = "johnny.appleseed"
user.email = "[email protected]"
user.msisdn = "00905XXXXXXXXX"
user.name = "Johnny"
user.surname = "Appleseed"
user.language = NSLocale.preferredLanguages[0]
var birthComponents = DateComponents()
birthComponents.year = 1774
birthComponents.month = 9
birthComponents.day = 26
let calendar = Calendar(identifier: .gregorian)
user.dateOfBirth = calendar.date(from: birthComponents)
user.gender = NetmeraProfileAttributeGender.male
user.maritalStatus = NetmeraProfileAttributeMaritalStatus.married
user.numberOfChildren = 10
user.country = "United States"
user.state = "MA"
user.city = "Leominster"
user.district = "Leominster"
user.occupation = "Farmer"
user.industry = "Agriculture"
user.favouriteTeam = "FAVOURITE_TEAM"
user.externalSegments = ["segment1", "segment2"]
// Send data to Netmera
Netmera.update(user)
You can also update any attribute independent from the others.
// Set user's properties
NetmeraUser *user = [[NetmeraUser alloc] init];
user.userId = @"johnny.appleseed";
user.email = @"[email protected]";
user.MSISDN = @"00905XXXXXXXXX";
user.name = @"Johnny";
user.surname = @"Appleseed";
user.language = NSLocaleIdentifier;
NSDateComponents *birthComponents = [[NSDateComponents alloc] init];
birthComponents.year = 1774;
birthComponents.month = 9;
birthComponents.day = 26;
NSCalendar *calendar = [[NSCalendar alloc]
initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
user.dateOfBirth = [calendar dateFromComponents:birthComponents];
user.gender = NetmeraProfileAttributeGenderMale;
user.maritalStatus = NetmeraProfileAttributeMaritalStatusMarried;
user.numberOfChildren = 10;
user.country = @"United States";
user.state = @"MA";
user.city = @"Leominster";
user.district = @"Leominster";
user.occupation = @"Farmer";
user.industry = @"Agriculture";
user.favouriteTeam = @"FAVOURITE_TEAM";
user.externalSegments = @[@"segment1", @"segment2"];
// Send data to Netmera
[Netmera updateUser:user];
You can also update any attribute independent from the others.
If you need to remove a previously set attribute from Netmera, you must set
[NSNull null]
object for corresponding attribute. Attribute must be an object type. Here is an example:Swift
Objective-C
// This will remove previously set `email` value from Netmera
let user = NetmeraUser()
user.email = ""
Netmera.update(user)
UserId cannot be removed:
userId cannot be removed even if you set
null
to it.// This will remove previously set `email` value from Netmera
NetmeraUser *user = [[NetmeraUser alloc] init];
user.email = [NSNull null];
[Netmera updateUser:user];
UserId cannot be removed:
userId cannot be removed even if you set
[NSNull null]
to it.Similar to events, you can generate a custom
NetmeraUser
subclass using Netmera Dashboard if the set of built-in attributes is not enough for use case.If the custom attribute is to be created on the Netmera, it must first be defined in the panel on (Developers->Profile Attributes).
Netmera will automatically generate the source files for your custom user class, so that you can easily use them to send information about your custom attributes.
Generated Code:
For all custom profile attributes, you can find the generated code at the bottom of the 'Profile Attribute' page under the 'Generate Code' section. Be sure to include this generated code in your Netmera Panel under the title Profile Attributes > User Class.

The sharing of private datas are prohibited under KVKK law. In the profile and event definitions in the application, firstly the user defines the attributes in the Netmera panel. When the Private Information feature is selected while defining, the value of the attribute is not passed to the backend by the Netmera SDK. This check is done on the SDK side (Netmera.update(user)), the request does not go backend.

Utilize this method to retrieve and showcase the coupons that users have earned within your iOS application using Swift.
let filter = NetmeraCouponFilter()
filter.page = Int32(pageSize)
filter.max = Int32(max)
Netmera.fetchCoupon(using: filter) { coupons, error in
self.coupons = coupons ?? []
self.tableView.reloadData()
}
Last modified 17d ago