Identification of the user or of the device is achieved through the $user_identifiers property. We encourage you to use as many identifiers as available in your environment at the time of the capture.
It is still possible to use the identifiers properties at the activity root level ($user_agent_id, $user_account_id + $compartment_id, $email_hash), however these are to be considered as legacy.
$user_identifiers property is to be preferred.
Create / Update a UserProfile from within an activity
A UserProfile can be created / updated by registering a UserActivity containing a $set_user_profile_properties event. In that case you would need to use $user_account_id and $compartment_id inside $properties to identify the UserProfile to update:
Note that you can used any identifier available on the UserPoint in the UserActivity object
Create / Update a UserChoice from within an activity
A UserChoice can be created / updated by registering a UserActivity containing a $set_user_choice event.
This method is used when you want to achieve real-time tracking but can't use the mediarithmics JavaScript Tag. In mobile applications for example.
Please note that those events will go through the processing pipeline before being stored as a UserChoice. You must ensure no activity analyzers is removing them during that process.
UserPoint API
UserPoint selector
The attribute :userPointSelector is used to select the UserPoint on which apply the query. You can provide the following values :
Create / Update a UserProfile
An other way to create / update a UserProfile is to use the user_profiles API endpoint . Prefer this method if you are able to integrate various API endpoints and if you don't need to track the UserProfile update as an event for further retrieval.
The body of the request must be a UserProfile object.
Path Parameters
Name
Type
Description
userAccount
string
The user_account_id linked to the user_profile that should be imported
compartmentId
integer
The ID of the compartment in which the UserProfile should be imported
datamartId
integer
The ID of the datamart in which the UserProfile should be imported
userSelector
string
The identifier of the user for whom the UserProfile should be imported.
see the options of the user selector.
Query Parameters
Name
Type
Description
update_strategy
Enum (Optional)
Values are PARTIAL_UPDATE, PARTIAL_DELETE, FORCE_REPLACE
(Detailed examples)
Legacy parameters (use update_strategy instead)
Name
Type
Description
force_replace
boolean (optional)
If true, then the UserProfile will be completely replaced by the object passed in the user_profile field.
If false, the object passed in the user_profile field will be merged with the existing UserProfile of the UserPoint.
merge_objects
boolean (optional)
Only considered if force_replace is false.
Manage the comportement between two objects with a same property.
If false (default value), the new object overrides the existing one.
If true the new object is merged in deep to the existing one (see example).
$compartment_id & $user_account_id in the payload are not mandatory since they are already provided as query parameters.
Beware of :
<COMPARTMENT_ID> & <USER_ACCOUNT_ID> which are used to select the UserPoint
:compartmentId & :userAccountId which are used to select the profile to update
Create / Update a UserChoice
An other way to create / update a UserChoice is to use the user_choices API endpoint . Prefer this method if you are able to integrate various API endpoints.
// Select a UserPoint using a user_point_id
/v1/datamarts/<DATAMART_ID>/user_points/<USER_POINT_ID>/user_profiles/compartment_id=:compartmentId/user_account_id=:userAccountId
/v1/datamarts/<DATAMART_ID>/user_points/user_point_id=<USER_POINT_ID>/user_profiles/compartment_id=:compartmentId/user_account_id=:userAccountId
// Select a UserPoint using a user_agent_id
/v1/datamarts/<DATAMART_ID>/user_points/user_agent_id=<USER_AGENT_ID>/user_profiles/compartment_id=:compartmentId/user_account_id=:userAccountId
// Select a UserPoint using a user_account_id + compartment_id
/v1/datamarts/<DATAMART_ID>/user_points/compartment_id=<COMPARTMENT_ID>,user_account_id=<USER_ACCOUNT_ID>/user_profiles/compartment_id=:compartmentId/user_account_id=:userAccountId
// Select a UserPoint using an email_hash
/v1/datamarts/<DATAMART_ID>/user_points/email_hash=<EMAIL_HASH>/user_profiles/compartment_id=:compartmentId/user_account_id=:userAccountId