How Amplitude Works


See the new developer docs

The new Amplitude Developer Center is in beta! Check it out. This site will be redirected on June 30, 2022.

To understand how Amplitude works, let’s walk through a hypothetical example.

Tunes is a standard music player for mobile devices that has common actions like playing a song, skipping a song, shuffling play, and sharing a song.

Using Amplitude, you can track all the actions your users make in detail and better understand what’s working and what’s not.

What actions will Amplitude keep track of?

Amplitude gives you the power to determine what’s important to your experience. You can choose to track anything and everything.

For example, in Tunes, you could track the music control buttons the users presses or even how many songs each user has listened to in each session.

Events represent actions users have taken

Every time an action happens that you wish to keep track of, you send an Event to Amplitude. Events can be as easy as choosing the text string that defines them.
For example, in Tunes, you could send an “Play Song” event every time a user presses the Play button.

amplitude.getInstance().logEvent(‘play song’);
[[Amplitude instance] logEvent:@"play song"];
Amplitude.getInstance().logEvent("play song");
Amplitude.Instance.logEvent("play song");

Here is a chart with the number of songs played on each day:

Event Properties provide context

Event Properties give you context about events, like where in your app they occur or what state the app is in when it occurred.
For example, in Tunes, when someone presses the “Play Song” event, using an Event property, you could also track the title of the song being played, the artist, the genre, etc. Any detail related to the Event itself is can act as an event property.

amplitude.getInstance().logEvent('play song',
    { title: 'Here comes the Sun',
      artist: 'The Beatles', genre: 'Rock'});
NSMutableDictionary *songProperties = [NSMutableDictionary dictionary];
[songProperties setValue:@"title" forKey:@"Here comes the Sun"];
[songProperties setValue:@"artist" forKey:@"The Beatles"];
[songProperties setValue:@"genre" forKey:@"Rock"];
[[Amplitude instance] logEvent:@"play song" withEventProperties:songProperties];
JSONObject songProperties = new JSONObject();
try {
    songProperties.put("title", "Here comes the Sun");
    songProperties.put("artist", "The Beatles");
    songProperties.put("genre", "Rock");
} catch (JSONException exception) {
Amplitude.getInstance().logEvent("play song", songProperties);
Dictionary<string, object> songProperties = new Dictionary<string, object>() {
  {"title" , "Here comes the Sun" },
  {"artist" , "The Beatles"},
  {"genre" , "Rock"}
Amplitude.Instance.logEvent("play song", songProperties);

Here is a chart with the songs played per day in each genre:

User Sessions are a series of Events within a single visit

User Sessions allow you to track series of events that are performed within a single visit or interaction with your application.

Most often, Amplitude keeps track of session automatically for you. If you are using the HTTP API, you will need to handle sessions manually.

User Properties are details about your User

User Properties help understand your User at the time they performed actions within your application. What state they were in, their preferences, or their device details, are all examples of common user properties.

For example, in Tunes, you could keep track of whether or not a User was on a paid or free plan. This will allow you to segment these users by this property, and compare paid vs free users (or only consider the behavior of paying users).

var identify = new amplitude.Identify().set('plan', 'premium');
AMPIdentify *identify = [[[AMPIdentify identify] set:@"plan" value:@"premium"]];
[[Amplitude instance] identify:identify];
Identify identify = new Identify().set("plan", "premium");
Amplitude.Instance.setUserProperty("plan", "premium");

Here is an example of a chart segmented on the user property "gender":

Did this page help you?