Thanks for reaching out here @kennyw Usage Time is calculated by:sum( max(event_time in session) - session_id)
i.e sum of usage time of all sessions, in milliseconds. For additional information about the dashboard API visit our developer docs here. I’m going to share this with our support team who can assist with the second part of your question.
Hi @kennyw
From what details you have provided above, here are couple of points -
AFAIK, the user activity endpoint is the only way of getting the "usage_time"
for an individual user.
@Saish Redkar Yes I do see Usage Time populated in the user profile. It only shows up as null in the user activity endpoint response.
We want to fetch usage time on a per-user per-session basis, so we can see ourselves hitting the rate limit for the user activity endpoint pretty easily. Do you know if there are any future plans for supporting a user property endpoint or any workarounds for our use case? Thank you!
That’s weird. Ideally, the user profile’s Total Sessions and Usage Time should be mapping to the user activity response datapoints of "num_sessions" and "usage_time". Not sure what’s the issue here.
Maybe Amplitude Support team can help out here if that’s a bug.
Re. the per-user per-session basis requirement, I don’t know if there is any endpoint which does that for now. The user activity endpoint looks the easiest option. All the other relevant ones are for aggregate session metrics.
You can try creating the desired session chart and fetch some data using the existing chart endpoint if that fits your case.
num_sessions, num_events, and usage_time are null from the endpoint (I’ve tested for multiple users), and those fields populate fine on the user profile.
This is what the end of the response object looks like (omitted other fields).
{"events": n], "userData": {... "aliasing_user_ids": i], "aliased_user_id": null, "aliasing_profiles": {}, "num_events": null, "num_sessions": null, "usage_time": null, "device_ids": null}, "metadata": {"missingData": false, "queryIds": I], "cached": false, "timeComputed": null, "kronosRuntime": 0, "kronosRequestDuration": 0, "subCluster": 0}}%