Search code examples
amplitude-analytics

How can I get Amplitude metrics for New Users via the API?


For the Amplitude REST API, the 'event_type' for the system event '[Amplitude] Any Event' is '_active', as mentioned here: https://amplitude.zendesk.com/hc/en-us/articles/205469748-Dashboard-Rest-API-Export-Amplitude-Dashboard-Data#query-parameters

I use this to get my active users like so:

curl -u KEY:SECRET 'https://amplitude.com/api/2/events/segmentation?e=\{"event_type":"_active"\}start=20170301&end=20170321'

What is the 'event_type' for the system event '[Amplitude] New User'?


Solution

  • I believe that the Amplitude documentation is incorrect, or at best ambiguous and that has led to confusion. "event_type":"_active" refers to "active events" and not "active users". So your query is returning the users who have performed any active event during the specified date range. This is subtly different from what you actually want - which is the new (or active) users who have performed any event. You are interested in the properties of the users who are new. Right? Otherwise it kinda doesn't make sense. A user is defined as new by the fact that they have logged an event for the first time. i.e. there is no historical event data for new users.

    Consider this:

    Amplitude screenshot

    The Amplitude documentation (if I am correct) should say:

    For '[Amplitude] Any Active Event', use "_active".

    I suspect what you really want is this:

    curl -u KEY:SECRET 'https://amplitude.com/api/2/users?m=new&start=20170301&end=20170321'
    

    As documented here...

    https://amplitude.zendesk.com/hc/en-us/articles/205469748-Dashboard-Rest-API-Export-Amplitude-Dashboard-Data#active-and-new-user-counts

    Hope that helps!