Skip to main content

I am writing to seek assistance with regards to utilizing the Amplitude API for tracking user activity within our application.

Our team is currently working on implementing a feature that requires tracking user engagement and activity patterns. Specifically, we need to track users who log in to our app consecutively for 15 days and spend a minimum of 10 minutes each day within the same user account.

After reviewing the documentation provided by Amplitude, I believe that the Event Segmentation API or a similar API endpoint might be suitable for our requirements. However, I would greatly appreciate your guidance on which specific API endpoints and parameters would be most appropriate for achieving this goal.

Could you please advise on:

1. Which API endpoints and parameters should we use to track user logins and session durations?
2. How can we set up the query to identify users who meet the specified criteria of logging in consecutively for 15 days and spending a minimum of 10 minutes each day in the same   account?
3. Are there any additional considerations or best practices we should keep in mind when implementing this tracking functionality?
Any insights or recommendations you can provide would be immensely helpful in ensuring that we correctly leverage the capabilities of the Amplitude platform for our use case.

Thank you very much for your assistance. I look forward to your prompt response.

Hi @Pratik Bhatt 
1. There are Session chart specific endpoints in the API which will give you some sessions stats on a aggregate user level

e.g https://www.docs.developers.amplitude.com/analytics/apis/dashboard-rest-api/#get-session-length-distribution

https://www.docs.developers.amplitude.com/analytics/apis/dashboard-rest-api/#get-average-sessions-per-user

If you are looking at session count at individual user level, then the User Activity endpoint should help which has the “sessions” value for the user queried.

The event segmentation chart endpoint on your login event will be ideal to chart your daily user logins in aggregate.

2. The dashboard API endpoints will mostly help output the aggregate stats from a given chart or on the fly query. I don’t think any endpoint in here will give you the user ids satisfying this conditions dynamically. You will have to tap the Behavioral Cohort API to get the user_ids from a prebuilt cohort based on your conditions. But I haven’t seen any clause yet in cohort definition which allows us to specify session duration filter.

You can try building this cohort and applying in sessions chart with the session filter and then see if you can extract the number of users from the existing chart endpoint. The main gap here is that not all clauses from charts are exposed while querying the dashboard API endpoints.


Reply