A5 : Send custom user data - adobe-target/mobile-demo-android GitHub Wiki

You can send additional information about the location or the user to Target as name-value pairs. This information can be used to build custom audiences (eg: users with greater than 25000 points) and in reporting.

There are two types of parameters that you can send with a Target call - mbox parameters and profile parameters.

Profile parameters are stored in the visitor profile store and are persistent across sessions. Mbox parameters don't persist. While there are reserved some keys, both profile and mbox parameters can be custom key-value pairs.

Create a hashmap

First, create a hashmap with the values that you send to pass to Target. Here is a sample hashmap. The values for keys like loyaltyAccount and profile.memberLevel are hard-coded in this example. In general, you will be passing in the corresponding variables.

    Map<String, Object> targetParams = new HashMap<String, Object>();
    targetParams.put("male", "profile.gender");
    targetParams.put("platinum", "profile.memberLevel");
    targetParams.put("true", "loyaltyAccount");
    targetParams.put("fashion", "entity.category");
    targetParams.put("abcd1234", "entity.id");
    targetParams.put("abcd1234", "mbox3rdPartyId"); // mbox3rdPartyId is a reserved key where you can pass your crm/internal user id
    targetParams.put("android.dev", "env");         // The value (eg: ios.prod) needs to be dynamic based on the app environment.
                                                    // This is used for building audiences for testing
  • Keys with the prefix profile (eg: profile.gender) are stored on the user's profile. These profile attributes can be used across different activities and channels.
  • Keys that don't have any prefix (eg: loyaltyAccount) are mbox parameters. These parameters are available only during the session.
  • Keys with the prefix entity (eg: entity.category.id) are used for product recommendations.

Send the data to Target

Your call should look like this now

TargetLocationRequest locationRequest = Target.createRequest(mbox, defaultContent, targetParams);

Verify the data

  1. In your application, set Config.setDebugLogging(true); This will print detailed debug logs.

  2. Build the app

  3. Verify that the parameters are passed in the target call. Search for your target location name in your debug console. You will see a call to YOUR-CLIENT-CODE.tt.omtrdc.net with all the parameters that you just passed.

You can build audiences and restrict or target the display of content using these params in the Target Standard UI.