1.1 Authentication
Access to the data for a given application is granted only after the authentication process is successful. The identity of each application is unique and is represented by the App id. Similarly, each App id has one and only one valid authentication key. You can create or update your authentication key from the App Settings. So the App id is used to recognize the identity of the given application while the API key is used to authenticate it. The authentication parameters can be submitted directly on the request header or through the request URL. The examples in the document use the following authentication parameters:
1 | App id | 60f6c0b8b97ba419120b82eb |
2 | API key | 9c633412-927a-4f4e-87bc-386dc1e3a618 |
The authentication parameters used in the API requests can be retrieved from the account settings through the following steps.
- Go to Account Settings and then on to the Application tab.
- Click on the Public API access tab.
- If an API key does not exist or you want to generate a new key, click on the Generate random API key.
1.2 Filtering
Filters are used to reduce the overall data so that you can concentrate your analysis on the reduced subset. The type of filters that can be applied to a data field depends on the type of the data field. All the allowed filters and their usage for the different data types are explained in the following section.
Example: Give me count of sessions where the application version is 2.0.
Parameters:
- daterange
- device_app_version
Operations:
- Filter applied on daterange and device_app_version.
Example: Consider an API request to filter sessions where the device_app_version is 2.0 for a date range of 3 months.
https://api.uxcam.com/session/analytics?
appid=60f6c0b8b97ba419120b82eb&
apikey=9c633412-927a-4f4e-87bc-386dc1e3a618&
daterange={"from": "2021-07-30", "to": "2022-03-02"}&
filter=[{"device_app_version":{"operator": "is", "value":"1.5" }}]
{
"success": true,
"data": [
{
"session_count": 22637,
"session_unique_user_count": 3977,
"session_new_user_count": 570,
"dashboard_link": "https://app.uxcam.com/app/60f6c0b8b97ba419120b82eb/sessions/list/1?dateRange={\"from\":\"2021-07-30\",\"to\":\"2022-03-02\"}&appversion={\"o\":\"in\",\"v\":[\"1.5\"]}"
}
]
}
Note: The sample responses are only added for reference and interpretation of different cases. Requesting the demo system might not give the same responses as in the examples.
1.2.1 Date range filter
Every API request fetches data for a given date range. The date range is given by the start date and the end date. If the range is not explicitly specified, the default range of 24 hours is used.
Example: Give me count of sessions.
Parameters:
- daterange
Operations:
- Filter applied on daterange.
Example: Consider an API request to filter sessions for a date range of 3 months.
https://api.uxcam.com/session/analytics?
appid=60f6c0b8b97ba419120b82eb&
apikey=9c633412-927a-4f4e-87bc-386dc1e3a618&
daterange={"from": "2021-07-30", "to": "2022-03-02"}
{
"success": true,
"data": [
{
"session_count": 10091,
"session_unique_user_count": 209,
"session_new_user_count": 29,
"dashboard_link": "https://app.uxcam.com/app/5e96a0513596b900b44eeafa/sessions/list/1?dateRange={\"from\":\"2020-07-30\",\"to\":\"2020-10-30\"}"
}
]
}
The following table shows the filters for datetime data types:
Operator name | Operator data type | Example | |
---|---|---|---|
1 |
on |
Date string |
|
2 |
not_on |
Date string |
|
3 |
after |
Date string |
|
4 |
since |
Date string |
|
5 |
until |
Date string |
|
6 |
before |
Date string |
|
7 |
between_dates |
Date string |
|
1.2.2 Numerical filters
The following table shows the filters for integer or float data types:
Description | Operator | Example | |
---|---|---|---|
1 |
Equals |
eq |
|
2 |
Does not equal |
not_eq |
|
3 |
Greater than |
gt |
|
4 |
Less than |
lt |
|
5 |
Greater or equal than |
geq |
|
6 |
Less or equal than |
leq |
|
Note: The float data type does not support equals and does not equal filters.
1.2.3 String filters
The following table shows the filters for string data types:
Description | Operator | Example | |
---|---|---|---|
1 |
Equals |
eq |
|
2 |
Does not equal |
not_eq |
|
3 |
Is any of |
in |
|
4 |
Is any of |
not_in |
|
5 |
Contains |
contains |
|
6 |
Does not contain |
contains_not |
|
1.2.4 List filters
The following table shows the filters for list (string) data types:
Operator name | Attribute data type | Example | |
---|---|---|---|
1 |
has_any_of |
list (string) |
|
2 |
not_has_any_of |
list (string) |
|
1.2.5 Json filters
The following table shows the filters for json data types:
Operator name | Operator | Example | |
---|---|---|---|
1 |
in |
json (string) |
|
2 |
not_in |
json (string) |
|
3 |
contains |
json (string) |
|
4 |
contains_not |
json (string) |
|
5 |
gt |
json (integer) (valid for custom event property value of integer/float data type) |
|
6 |
lt |
json (integer) (valid for custom event property value of integer/float data type) |
|
1.3 Aggregation
Aggregation is a function to combine one or more data attributes. Aggregation functions give numerical values in the output so that they can be used to plot statistical charts.
Example:Give me the average length of sessions.
Parameters:
- daterange
- session_duration
Operations:
- Filter applied on daterange.
- Aggregation done on session_duration.
Example: Consider an API request to aggregate session_duration using an average function for a date range of 3 months
https://api.uxcam.com/session/analytics?
appid=60f6c0b8b97ba419120b82eb&
apikey=9c633412-927a-4f4e-87bc-386dc1e3a618&
daterange={"from": "2021-07-30", "to": "2022-03-02"}&
aggregation=[{'attribute':'session_duration','operator':'avg'}]
{
"success": true,
"data": [
{
"count": 36471.0,
"avg_session_duration": 95.26,
"dashboard_link": "https://app.uxcam.com/app/60f6c0b8b97ba419120b82eb/sessions/list/1?dateRange={\"from\":\"2021-07-30\",\"to\":\"2022-03-02\"}"
}
]
}
Functions | Tables | Attribute data type | Example |
---|---|---|---|
count |
All tables |
No attribute should be selected |
|
Count distinct user |
Event, session |
No attribute should be selected |
|
Count distinct session |
Event |
No attribute should be selected |
|
Sum / Average / Minimum / Max |
All tables |
Float, int, bool |
|
Sum / Average / Minimum / Max |
json |
Event only |
|
1.4 Grouping
Grouping is used to group the data attributes and thus show the distribution of the attributes or properties for a given aggregation.
Example: Give me the count of sessions by application version where the session video recording was enabled.
Parameters:
- daterange
- session_has_video
- device_app_version
Operations:
- Filter applied on daterange and session_has_video.
- Grouping done on device_app_version.
Example: Consider an API request to filter sessions containing videos (session_has_video is true) and group the result by device_app_version.
https://api.uxcam.com/session/analytics?
appid=60f6c0b8b97ba419120b82eb&
apikey=9c633412-927a-4f4e-87bc-386dc1e3a618&
daterange={"from": "2021-07-30", "to": "2022-03-02"}&
filter=[{"session_has_video":{"operator": "is", "value":"true" }}]&
group_by=[{"attribute":"device_app_version"}]
{
"success": true,
"data": [
{
"device_app_version": "2.0",
"session_count": 9,
"session_new_user_count": 2,
"session_unique_user_count": 3,
"dashboard_link": "https://app.uxcam.com/app/5e96a0513596b900b44eeafa/sessions/list/1?dateRange={\"from\":\"2020-07-30\",\"to\":\"2020-10-30\"}&appversion={\"o\":\"in\",\"v\":[\"2.0\"]}&video={\"o\":\"istrue\",\"v\":\"true\"}"
},
{
"device_app_version": "1.0 (1)",
"session_count": 12,
"session_new_user_count": 6,
"session_unique_user_count": 6,
"dashboard_link": "https://app.uxcam.com/app/5e96a0513596b900b44eeafa/sessions/list/1?dateRange={\"from\":\"2020-07-30\",\"to\":\"2020-10-30\"}&appversion={\"o\":\"in\",\"v\":[\"1.0 (1)\"]}&video={\"o\":\"istrue\",\"v\":\"true\"}"
},
{
"device_app_version": "1.0",
"session_count": 73,
"session_new_user_count": 20,
"session_unique_user_count": 21,
"dashboard_link": "https://app.uxcam.com/app/5e96a0513596b900b44eeafa/sessions/list/1?dateRange={\"from\":\"2020-07-30\",\"to\":\"2020-10-30\"}&appversion={\"o\":\"in\",\"v\":[\"1.0\"]}&video={\"o\":\"istrue\",\"v\":\"true\"}"
}
]
}
Note : Grouping can be done by all attributes of these attribute types: integer,string,date,and bool.
Attribute | Attribute type | Example | |
---|---|---|---|
1 |
user_country |
string |
|
2 |
user_session_duration |
integer |
|
3 |
session_is_crashed |
bool |
|
4 |
session_date_day |
Date |
|
5 |
event_custom_property |
json |
|
1.5 Supplementary parameters
There are two types of supplementary parameters: link, and comparison. Setting the link parameter to true link=true will return a response with an additional link to the UXCam dashboard. By default, the response will contain the respective dashboard links.
If the comparison parameter is set to true comparison=true then it will return a response with a percent change compared with the previous date. The previous date is an exact duration before the selected range. For example, if the currently selected date range is one month then the previous date will be last month.
In this example, as the link is set to false, no dashboard link is generated in the response. Similarly, the percentage change values are represented by properties with pct_change suffix.
https://api.uxcam.com/event/analytics?
appid=60f6c0b8b97ba419120b82eb&
apikey=9c633412-927a-4f4e-87bc-386dc1e3a618&
daterange={"from": "2021-07-30", "to": "2022-03-02"}&
link=false&
comparison=true
{
"success": true,
"data": [
{
"event_count": 16,
"event_unique_user_count": 5,
"event_unique_session_count": 8,
"event_count_pct_change": 128.5714,
"event_unique_user_count_pct_change": 400,
"event_unique_session_count_pct_change": 300
}
]
Note: The comparison parameter does not work with grouping parameters.
Attribute | Attribute type | Example | |
---|---|---|---|
1 |
user_country |
string |
|
2 |
user_session_duration |
integer |
|
3 |
session_is_crashed |
bool |
|
4 |
session_date_day |
Date |
|
5 |
event_custom_property |
json |
|