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.
- In the Data Collection UI, in your mobile property, select the Extensions tab.
- On the Catalog tab, locate or search for the Profile extension, and select Install.
- There are no configuration settings for Profile.
- Select Save.
- Follow the publishing process to update SDK configuration.
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 (AEP 3.x)" %}
- Add the Mobile Core and Profile extensions to your project using Cocoapods. Add following pods in your
Podfile
:
use_frameworks!
target 'YourTargetApp' do
pod 'AEPCore', '~> 3.0'
pod 'AEPUserProfile', '~> 3.0'
end
- Import the UserProfile library.
import AEPCore
import AEPUserProfile
@import AEPCore;
@import AEPUserProfile;
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
- Add the Mobile Core and Profile extensions to your project using Cocoapods. Add following pods in your
Podfile
:
use_frameworks!
target 'YourTargetApp' do
pod 'ACPCore'
pod 'ACPUserProfile'
end
- Import the UserProfile library.
import ACPCore
import ACPUserProfile
#import "ACPCore.h"
#import "ACPUserProfile.h"
{% endtab %}
{% tab title="Cordova" %}
After creating your Cordova app and adding the Android and iOS platforms, the UserProfile extension for Cordova can be added with this command:
cordova plugin add https://github.com/adobe/cordova-acpuserprofile.git
{% endtab %}
{% tab title="Unity" %}
After importing the ACPUserProfile.unitypackage, the UserProfile extension for Unity can be added with following code in the MainScript
using com.adobe.marketing.mobile;
{% endtab %}
{% tab title="Xamarin" %}
After adding the iOS ACPUserProfile NuGet package or the Android ACPUserProfile NuGet package, the UserProfile extension can be added by this import statement
using Com.Adobe.Marketing.Mobile;
{% 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 {
// register other extensions
UserProfile.registerExtension();
MobileCore.start(new AdobeCallback () {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("yourAppId");
}
});
} catch (Exception e) {
//Log the exception
}
}
}
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
MobileCore.registerExtensions([UserProfile.self], {
})
...
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AEPMobileCore registerExtensions:@AEPMobileUserProfile.class] completion:^{
...
}];
...
// Override point for customization after application launch.
return YES;
}
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPCore.configure(withAppId: "yourAppId")
ACPUserProfile.registerExtension()
ACPCore.start(nil)
// Override point for customization after application launch.
return true;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPUserProfile registerExtension];
// Override point for customization after application launch.
return YES;
}
{% endtab %}
{% tab title="React Native" %}
When using React Native, register Profile with Mobile Core in native code as shown on the Android and iOS tabs. {% endtab %}
{% tab title="Cordova" %}
When using Cordova, register Profile with Mobile Core in native code as shown on the Android and iOS tabs. {% endtab %}
{% tab title="Flutter" %}
When using Flutter, register Profile with Mobile Core in native code as shown on the Android and iOS tabs. {% endtab %}
{% tab title="Unity" %}
Register the extension in the start()
function:
using com.adobe.marketing.mobile;
using using AOT;
public class MainScript : MonoBehaviour
{
[MonoPInvokeCallback(typeof(AdobeStartCallback))]
public static void HandleStartAdobeCallback()
{
ACPCore.ConfigureWithAppID("yourAppId");
}
// Start is called before the first frame update
void Start()
{
ACPUserProfile.registerExtension();
ACPCore.Start(HandleStartAdobeCallback);
}
}
{% endtab %}
{% tab title="Xamarin" %}
iOS
Register the User Profile extension in your app's FinishedLaunching()
function:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
ACPUserProfile.RegisterExtension();
// start core
ACPCore.Start(startCallback);
return base.FinishedLaunching(app, options);
}
private void startCallback()
{
// set launch config
ACPCore.ConfigureWithAppID("yourAppId");
}
Android
Register the User Profile extension in your app's OnCreate()
function:
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
ACPUserProfile.RegisterExtension();
// start core
ACPCore.Start(new CoreStartCompletionCallback());
}
class CoreStartCompletionCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object callback)
{
// set launch config
ACPCore.ConfigureWithAppID("yourAppId");
}
}
{% endtab %} {% endtabs %}