You can use the Profile extension to store attributes about your user on the client. This information can be used later to target and personalize messages during online or offline scenarios, without having to connect to a server for optimal performance. The Profile extension manages the Client-Side Operation Profile (CSOP) and provides a way to react to APIs, updates user profile attributes, and shares the user profile attributes with the rest of the system as a generated event.
The Profile data is used by other extensions to perform profile-related actions. An example is the Rules Engine extension that consumes the profile data and runs rules based on the profile data.
Important: The Profile extension does not require any configuration.
To get started with the Profile extension:
- Configure the Profile Extension in Launch.
- Add the Profile extension to your app.
- Implement Profile APIs to:
- Update user attributes.
- Remove user attributes.
To add the Profile extension to your app:
{% tabs %} {% tab title="Android" %}
-
Add the
UserProfile
library to your project using the app's gradle file. -
Import the
UserProfile
library and any other SDK library in your application's main activity.import com.adobe.marketing.mobile.*;
{% endtab %}
{% tab title="iOS" %}
- Add the UserProfile library to your project via your
Podfile
by addingpod 'ACPUserProfile'
. - Import the UserProfile and Identity library.
#import "ACPCore.h"
#import "ACPUserProfile.h"
import ACPCore
import ACPUserProfile
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Android" %}
Required: The setApplication()
method must be called once in the onCreate()
method of your main activity.
-
The
UserProfile
extension must be registered with Mobile Core before calling anUserProfile
API.This can be done after calling
setApplication()
in theonCreate()
method. Here is a code sample, which calls these set up methods:
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
try {
UserProfile.registerExtension();
} catch (Exception e) {
//Log the exception
}
}
}
{% endtab %}
{% tab title="iOS" %}
Required: You must complete the following steps in the app before calling other UserProfile
APIs.
- In your app's
didFinishLaunchingWithOptions
function register theUserProfile
extension.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPUserProfile registerExtension];
// Override point for customization after application launch.
return YES;
}
{% endtab %} {% endtabs %}