User Profile Batch Upload
The User Profile Batch Upload allows you to load and update multiple user profiles simultaneously. It provides a way to store user attribute information and can load customer segments, attributes, user linkings, or user preferences into the User Profile Service. This data then becomes available for use with the Algonomy Personalization Cloud. When a batch file is processed, any existing data for a user in the new file is replaced with the data from the file. Users not contained in the file remain unchanged.
By uploading a batch of users and user attributes, segments, user linkings, and preferences that you have already identified, you can start benefiting from UPS more quickly.
This topic covers one method of importing data into the User Profile Service. It is intended for anyone considering implementing User Profiles as part of their Omni-channel Personalization integration, as well as Algonomy employees, partners, and new users of the Service.
How It Works
Full Feed and Delta Feed
The JSON data file is uploaded via FTP. Personalization Cloud supports both full and incremental (delta) types of Batch Upload. You can find more information regarding the differences between Full Feed and Delta Feed here.
Batch File
File Format
The file is a simple JSON data file. Each individual object in the file will have two fields: ‘userId’ and ‘value’. 'userId' is the user profile to attach the data to, and 'value' is the JSON object that will be returned from that ID upon request.
Note: Only data uploaded as segments can be used in the dashboard segment builder and merchandising rules, user attributes can only be stored in the UPS.
Here’s an example of what this may look like for user segment data.
{“userId”: “13579”, “value”: {“seg2134″: ”Dog Owner”, “seg50plus”: ”High Spender”, “Platinum”: “Platinum Member”}}
{“userId”: “bob789″, “value”: {“seg345″: ”Cat Owner”}}
{“userId”: “jill456″, “value”: {“seg345″: ”Cat Owner”, ”silver”: ”Silver Loyalty Member”}}
Another example that loads data for user preferences would look like
{“userId”: “john123″, ”value”: {“like”: [“prod102710186″, ”prod102480209″, ”prod100800220″, ”prod101000082″], ”disLike”: [“prod10150001″, ”prod101010003″, ”prod00780″, ”prod102540091″, ”prod101910083″, ”prod101520076″]}}
{“userId”: “jill456″, ”value”: {“like”: [“prod102710186″,”prod102480209″], ”disLike”: []}}
{“userId”: “joe345″, ”value”: {“like”: [“prod102710186″], ”disLike”: [“prod102480209″]}}
Another example that loads data for user attributes would look like
{“userId”: “john123″, ”value”: {"haircolor": ["brown", "black"], "eyecolor": ["green"]}}
{“userId”: “jill456″, ”value”: {"haircolor": ["grey"], "eyecolor": ["blue"]}}
{“userId”: “joe345″, ”value”: {"haircolor": ["blonde"], "eyecolor": ["blue"]}}
Note: Each attribute type (attributes or preferences) must be loaded as a separate file into UPS.
Uploading File
You can upload batch attributes into the User Profile using either FTP or SFTP-based data ingestion, depending on your use case.
To upload the batch attributes into the User Profile using FTP, load the file onto the FTP server and run the UPSBATCH operation. The SFTP-based data ingestion upload files as compressed archives (for example, .zip, .tar.gz). It includes a metadata file that defines the ingestion command (upsbatch) and attribute (for example, rr-segments). Files are processed asynchronously, without requiring manual commands. For more information on SFTP data ingestion, refer to SFTP Offline Data Ingestion.
The -attribute argument is required to define the type of customer attribute being stored in the User Profile. For Algonomy applications to recognize these attributes properly, predefined attribute options must be used. For example, when uploading customer segment information, use rr-segments so it can be recognized and used across applications.
ftp build-ftp.richrelevance.com 2222
put ~/sample_segments.txt sample_segments.txt
site upsbatch sample_segments.txt -attribute rr-segments
Each time a new file is uploaded for the same attribute and users, the existing data is overwritten.
For example, assume you had originally provided user preference data to say User-A likes {product 1, product 2}. Then if in a subsequent update, you provide us User-A likes {product 3, product 4}, then the response from the User Profile Service would indicate User-A likes {product 3, product 4} and not {product 1, product 2}.
The following attribute types are supported for batch uploads:
-
rr-segments: Defines a list of segments for each user
-
rr-userattributes: Defines a list of user attributes
-
rr-preferences: Defines a list of user preferences
Each attribute type must be uploaded as a separate file into UPS.
Note: Batch uploads for the User Profile Service require configuration to be enabled. Contact your Algonomy representative to enable this feature for your site.
User Profile Response
When using the User Profile API to get data about a specific user, the batch uploaded data for that user is returned under a “batchAttribute” section, as shown in the example below.
"batchAttributes": {
"john123": {
"rr-segments": [
{"seg123": "Dog Owner"},
{"platinum": "Platinum Loyalty Member"}
],
"rr-preferences": {
'like': [prod102710186,prod102480209,prod100800220,prod101000082],
'disLike': [prod10150001,prod101010003,prod00780,prod102540091,prod101910083,prod101520076]
}
}
}