Searching sessions
You can use the REST API to search in your user sessions by adding filters to your POST
call. For documentation, see Search sessions.
Filtering user sessions
To search your user sessions using the REST API, you need to create a filters
array. If you want your results in the response to be sorted in a particular way, you can add an optional sort
object.
filters
objects
filters
objectsThe objects in the filters
array must contain three parameters: name
, operator
, and value
.
The uid
, user_email
, user_name
, location_ip
, landing_url
, exit_url
, source_referer
, and recording_url
objects can be constructed with the following operators
:
"name": "<name of the object>",
"operator": "is"|"is_not"|"contains"|"not_contains",
"value": <string>
The session_duration
object can be constructed with the following operators
:
"name": "session_duration",
"operator": "lte"|"gte",
"value": <number>
You can also add the optional sort
object.
{timeStart: 'asc'|'desc'}
Example user session search
Let's look at the following example. You want to find all sessions that are 30-40 seconds. To find user sessions that match your needs, you need to add two filters to your POST
:
POST https://api.eu.smartlook.cloud/api/v1/sessions/search
{
"filters": [
{
"name": "session_duration",
"operator": "lte",
"value": 40
},
{
"name": "session_duration",
"operator": "gte",
"value": 30
}
],
"sort": {
"timeStart": "asc"
}
}
The filters used in the example contain the name of the filter session_duration
, the operators lte
(less than or equal to) and gte
(greater than or equal to), and the values of 30
and 40
. The final parameter, sort
, allows you to tell how you would like your results sorted.
The response returns all user sessions that are 30-40 seconds.
Updated about 1 month ago