Enrich users with identifiers
Declare that several identifiers belong to the same person, and merge their UserPoints.
Your goal
Tell the platform what your own systems already know: that a hashed email, an account ID, and a device identifier are the same person - so their histories become one.
Expected outcome
One UserPoint carrying all the identifiers on each line of your file, with the previously separate UserPoints merged into it.
Run an enrichment import
Create the document import
Document type USER_IDENTIFIERS_ASSOCIATION_DECLARATIONS, mime type APPLICATION_X_NDJSON. Only ndjson is supported.
curl -X POST \
https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports \
-H 'Authorization: <YOUR_API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"document_type": "USER_IDENTIFIERS_ASSOCIATION_DECLARATIONS",
"mime_type": "APPLICATION_X_NDJSON",
"encoding": "utf-8",
"name": "<YOUR_DOCUMENT_IMPORT_NAME>"
}'Create an execution with one declaration per line
Each line holds an identifiers array - a list of identifier resources of any type.
curl -X POST \
https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports/<DOCUMENT_IMPORT_ID>/executions \
-H 'Authorization: <API_TOKEN>' \
-H 'Content-Type: application/x-ndjson' \
-d '
{
"identifiers":[
{ "type": "USER_EMAIL", "hash":"<EMAIL_HASH>" },
{ "type": "USER_AGENT", "user_agent_id": "<USER_AGENT_ID>" },
{ "type": "USER_ACCOUNT", "user_account_id": "<USER_ACCOUNT_ID>", "compartment_id": "<COMPARTMENT_ID>" }
]
}
'Read the result
Check total_success, total_failure, and the error file. Pay attention to possible_issue_on_identifiers and top_identifiers - an identifier appearing far more often than expected usually means a placeholder value slipped into the file. See reading the result.
The identifier resources
An identifier resource takes one of several shapes, matching the identifier types.
type
"USER_EMAIL"
The type of the identifier.
hash
String
A hash of the email. The hashing function should be unique per datamart.
email
String, optional
The email address.
type
"USER_AGENT"
The type of the identifier.
user_agent_id
String
The user agent ID.
type
"USER_ACCOUNT"
The type of the identifier.
user_account_id
String
The user account ID.
compartment_id
String, optional
The compartment ID. If omitted, the default compartment is used.
What happens per line
The outcome depends on what the platform already knows about the identifiers you list:
One identifier matches an existing user
The other identifiers are attached to that user.
Several identifiers match different users
Those users are merged into a single user carrying all the identifiers.
No identifier matches
A new user is created with all the identifiers attached.
Verify
The execution reports the expected success count.
A test user that had two UserPoints now has one, carrying both identifier sets.
The UserPoint total in collection volumes drops by roughly the number of merges you expected - not by far more.
No ordinary user becomes a hyper point.
Related pages
Last updated
Was this helpful?