Users

Get some high-level statistics and details about a particular user, who has been identified via the tracker.setUserID JavaScript function. This endpoint returns things like firstSeen, lastSeen and numberSessions.

GET

/api/v1/:projectKey/users/:userId

NameTypeDescription
projectKeystringThe ID of the project you’re tracking (required)
userIdstringThe ID of your user, set via tracker.setUserID (required)

Authorization: {YOUR_ORGANIZATION_API_KEY}: The key can be found in ‘Preferences’ > ‘Account’ > ‘Organization API Key’.

200: Response sent as JSON in body

curl -X GET \
  https://openreplay.example.com/api/v1/3sWXSsqHgSKnE87YkNJK/users/mickael@openreplay.com \
  -H 'content-type: application/json' \
  -H 'Authorization: {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "userId": "mickael@openreplay.com",
    "sessionCount": 3,
    "lastSeen": 1623689478617,
    "firstSeen": 1623440822825
  }
}

Delete a user (identified via the tracker.setUserID JavaScript function) and all its data captured by OpenReplay. This fires up a background 1-time-job for removing all user related data, including sessions, events, metadata, custom events and recordings. The call returns a jobID that you can use later on to check the status of the delete operation.

This comes in handy for handling GDPR requests you may receive from your end users.

DELETE

/api/v1/:projectKey/users/:userId

NameTypeDescription
projectKeystringThe ID of the project you’re tracking (required)
userIdstringThe ID of your user, set via tracker.setUserID (required)

Authorization: {YOUR_ORGANIZATION_API_KEY}: The key can be found in ‘Preferences’ > ‘Account’ > ‘Organization API Key’.

200: Response sent as JSON in body

curl -X DELETE \
  https://openreplay.example.com/api/v1/3sWXSsqHgSKnE87YkNJK/users/mickael@example.com \
  -H 'content-type: application/json' \
  -H 'Authorization: {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "jobId": 22345,
    "description": "Delete user sessions of userId = mickael@example.com",
    "status": "scheduled",
    "projectId": 1,
    "action": "delete_user_data",
    "referenceId": "mehdi@openreplay.com",
    "createdAt": 1623912962910,
    "updatedAt": 1623912962910,
    "startAt": 1623954600000,
    "errors": null
  }
}

Change the replay-file delete time ?

Section titled Change the replay-file delete time ?

The deletion job is a 2 step process: First, sessions and their cascading events get deleted from the database overnight. Second, replay files are scheduled to expire (in 30 days) in the object storage.

If you’re using minio (vanilla installation), and you wish to change the default expiry/lifecycle policy, follow the below instructions:

  1. In your server, run openreplay -e
  2. Under the chalice section, define a new env variable called SCH_DELETE_DAYS with a value equal to the number of days you want to keep the replay file before delete (greater or equal to 0)
  3. Save and quit using :wq
  4. Run k9s -n db
  5. Use the keyboard arrows to navigate the list and get to the minio-* container
  6. Press s to have shell access the Minio (object storage) container
  7. Run mc alias set minio http://localhost:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
  8. To delete replay files 14 days after the delete-job execution
export EXPIRATION_DAYS=14
mc ilm add --expiry-days $EXPIRATION_DAYS --tags "to_delete_in_days=${EXPIRATION_DAYS}" minio/mobs
  1. Use exit to exit the Minio container
  2. Run :quit to exit the Kubernetes CLI