User Info

Information about the user of your app can be useful for personalization and segmentation. For example, you might want to address push notifications to each user by name or you may want to segment a campaign to only users who have opted-in to receive marketing material. The UserInfoManager service provides an API for you to add information about the current user that will be sent to Rover’s servers and can be utilized for personalization purposes in the Campaigns app and segmentation purposes in the Audience app.

Setting Properties

You can set info about the current user on the UserInfoManager service using the update(_:) method. The update(_:) method has a single parameter – a block with a copy of the currently set attributes. The attributes parameter is an inout parameter so you can make changes to it directly and don’t need to worry about returning a value. The parameter is of type Attributes which is similar to a dictionary of type [String: Any] but with some restrictions on the values you can assign.

Rover.shared?.resolve(UserInfoManager.self)?.update { attributes in
    attributes["first_name"] = "Sean"
    attributes["marketing_material_opt_in"] = true

Clearing Properties

In some cirucmstances you may wish to remove all properties associated with the current user. For example, if your app supports authentication and the user logs-out. To remove all user info call the clear() method on the UserInfoManager.

Required Modules
  • RoverFoundation
  • RoverData