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:
After creating your Cordova app and adding the Android and iOS platforms, the User Profile extension for Cordova can be added with this command:
cordova plugin add https://github.com/adobe/cordova-acpuserprofile.git
Get the extension version.
ACPUserProfile.extensionVersion(function(version) {console.log("ACPUserProfile version: " + version);}, function(error) {console.log(error);});
After creating your Flutter app and adding the Android and iOS platforms, the User Profile extension for flutter can be added in the pubspec.yaml
:
dependencies:flutter_acpcore: ">= 1.0.0"flutter_acpuserprofile: ">= 1.0.0"
Then fetch the packages with:
flutter pub get
Get the extension version.
import 'package:flutter_acpuserprofile/flutter_acpuserprofile.dart';String version = FlutterACPUserProfile.extensionVersion;
After adding the iOS or Android ACPUserProfile NuGet package, the User Profile extension for Xamarin can be added by this import statement:
using Com.Adobe.Marketing.Mobile;
Get the extension version.
ACPUserProfile.ExtensionVersion();
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 an UserProfile
API.
This can be done after calling setApplication()
in the onCreate()
method. Here is a code sample, which calls these set up methods:
public class MobileApp extends Application {@Overridepublic void onCreate() {super.onCreate();MobileCore.setApplication(this);try {UserProfile.registerExtension();} catch (Exception e) {//Log the exception}}}
Required: You must complete the following steps in the app before calling other UserProfile
APIs.
In your app's didFinishLaunchingWithOptions
function register the UserProfile
extension.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[ACPUserProfile registerExtension];// Override point for customization after application launch.return YES;}
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 coreACPCore.Start(startCallback);return base.FinishedLaunching(app, options);}private void startCallback(){// set launch configACPCore.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 coreACPCore.Start(new CoreStartCompletionCallback());}class CoreStartCompletionCallback : Java.Lang.Object, IAdobeCallback{public void Call(Java.Lang.Object callback){// set launch configACPCore.ConfigureWithAppID("yourAppId");}}