Data & Customization

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 UserInfo 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 user info service using the update method. The method takes a single parameter – a closure with an argument of a copy of the currently set attributes as a hash. Mutate those attributes to add the fields you desire, and they'll be merged into any other existing fields and values you have already set.

This arrangement allows you to perform partial updates to the existing user info.

Swift:

Rover.shared.userInfoManager.updateUserInfo(block: { attributes in
    attributes["first_name"] = "Sean"
    attributes["marketing_material_opt_in"] = true
}

Kotlin:

Rover.shared.userInfoManager.update { attributes ->
    attributes["first_name"] = "Sean"
}

When to set user info properties?

While the Rover SDK does persist the User Info settings, and allows you to do partial updates, we recommend also setting them each time the app starts up.

This helps you to handle cases like propagating all the values into Rover when the SDK is first integrated.

Clearing Properties

In some circumstances 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 user info service:

Swift:

Rover.shared.userInfoManager.clearUserInfo()

Kotlin:

Rover.shared.userInfoManager.clear()

Notification Channels

The Rover Platform recommends a standardized property entitled tags added to User Info as a way to segment users depending on their notification preferences. It should be formatted as a list of strings.

For example, you might have a channel for team news, and others for breaking news, podcast episodes, or marketing promotions. You can then use these channels to segment your audience and send notifications to only those users who have opted-in to a particular channel.

A typical UX for this is a set of switches exposed in your app's settings screen.

For example:

Swift:

Rover.shared.userInfoManager.updateUserInfo(block: { attributes in
    attributes["tags"] = [
        "breaking_news",
        "team_news",
        "podcast",
        "partner_offers"
    ]
}

Kotlin:

Rover.shared.userInfoManager.update { attributes ->
    attributes["tags"] = listOf(
        "breaking_news",
        "team_news",
        "podcast",
        "partner_offers"
    )
}

When to update notification channels?

As discussed above, it is recommended to update this value whenever a user changes their notification preferences, but also on app startup to ensure that the value is always up-to-date.

Previous
Third-party Analytics