top of page

Amplitude – The power of user properties

Introduction


Events have event properties that give context about the event itself. Users tracked in Amplitude have a similar property called a “user property” that provides context about the user. These can be regarded as traits or attributes. Think of the country a user resides in, the plan the user is on or the role that the user might have in the product your are tracking,


This article explains how user properties behave within Amplitude and how they can be leveraged in order to answer specific business questions. 


Setting user properties


In this example we will be using the Amplitude Browser SDK.

User properties are set in Amplitude using the identifyEvents method.


The following code sets the value for the user property “Plan Type” to “free”


const identifyEvent = new amplitude.Identify()

  .set('Plan Type', 'free')

amplitude.identify(identifyEvent)

As a result the following is mapped on top of the user profile.



More information on setting user properties using the Browser SDK can be found here


The inner workings of user properties


The power of user properties comes into play once we understand how they can be used to enrich events with the user context. 


Imagine the following flow of Amplitude calls:


  1. A user signs up and chooses a free plan


amplitude.setUserId('MusicStreamer1337');const identifyEvent = new amplitude.Identify()

  .set('Plan Type', 'free')

amplitude.identify(identifyEvent)

  1. A user listens to a song


amplitude.track("Song Played", {

    "Genre" : "Techno",

});

Once the “Song Played” event is ingested by Amplitude, Amplitude’s systems will look at the user properties mapped on top of the user’s profile. The event will then be enriched, on Amplitude’s servers, with the user properties of the specific user. This contextualises the event with the “state of the user” at the moment that the user generated the event. Only then is the event stored in Amplitude’s system and available for analysis. This casts the complete overview of the event, the event context represented by event properties and the user context represented by user properties in stone. 


It is “as if” every event not only has event properties explicitly sent to Amplitude appended to it, but also carries the user properties of the user and the values they carry at the moment the event was generated.


Example:

In our simplified example where the event “Song Played” was generated this means that the event which carries the property “Genre” and has value “Techno” gets enriched with the user property “Plan Type” which has value “free”.



This means that the user property value at the event level can differ from the user property value at the profile level, as the latter reflects the last value for that user while the former reflects the value at the time the event was generated.


The real power of user properties


Now that we know how user properties work, we can explore how they can be leveraged to conduct deeper analysis. Examples:


“How many “Song Played” events were triggered by users while on the free plan?”


To answer this question it suffices to select the “Song Played” event in Amplitude and select “Free” as “Plan Type” value in the “Segment users by” section.



A similar approach works for customer who are premium users.


“How many “Song Played” events were triggered by users while on the premium plan?”



“How many “Song Played” events were triggered by users who are on the premium plan today?”


Since we’re looking at the current value of the user property “Plan Type” we start by building a cohort.



Then we select the “Song Played” event and segment by cohort = our newly created cohort.

The result shows the total number of events for users who are on a premium plan today, regardless of what plan they were on when the events were generated.



The real power of user properties becomes visible when two “time frames” get used in a single analysis. One being historical user property values and the other being the current value. 


Imagine the following question:


How many “Song Played” events were triggered by users currently on a premium plan while on the free plan?


To answer this question we start by following the same steps as in our previous analysis. However, as we’re only interested in the events users who are on a premium plan today did while they were free users, we’ll use the user properties linked to the event to filter these.



Alternatively we can use the group by function in order to group the total number of events generated in the lifetime of a user who is on a premium plan today by the type of plan the user was on at the moment the event was generated.





Conclusion


User properties are an underestimated property type within the Amplitude environment which allows you to cast the profile of the user on top of each event at the moment the event is generated. It is specifically powerful when looking back in time and analysing behaviour of, let’s say, “top customers” before they became top customers and understand what patterns lead them to achieve that status.

Need help with Amplitude and/or Analytics in general? Feel free to reach out !

Komentáře


bottom of page