User activities import

Bulk import user activities to insert user activities that happened outside of real-time tracking. Those activities usually are offline activities, like store visits or store purchases, but you can adapt it to your use cases.

Activities imported through bulk import don't go through the activity processing pipeline. You shouldn't use this feature if you intend to do conversion detection or automation activation. Your activity analyzers also won't process those activities, and you should format exactly how you expect them to be stored by mediarithmics.


Use the bulk import endpoints to create a document import with theUSER_ACTIVITYdocument type and APPLICATION_X_NDJSON mime type. Only ndjson data is supported for user activities.

Then, create an execution with your user activities formatted in ndjson .


# Create the document import
curl -X POST \<DATAMART_ID>/document_imports \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
	"document_type": "USER_ACTIVITY",
	"mime_type": "APPLICATION_X_NDJSON",
	"encoding": "utf-8",
# Create the execution
curl -X POST \<DOCUMENT_IMPORT_ID>/executions \
  -H 'Authorization: <API_TOKEN>' \
  -H 'Content-Type: application/x-ndjson' \
  -d '{ "$user_agent_id": "<USER_AGENT_ID>", "$type":"TOUCH","$session_status":"NO_SESSION","$ts":<TIMESTAMP>,"$events":[{"$event_name":"$email_mapping","$ts":<TIMESTAMP>,"$properties":{}}]}'

You can, of course, upload multiple activities at once. Note the uploaded data is in ndjson and not json. That means the different activities are not separated by commas, but by a line separator \n

Last updated