How does Mixpanel treat numbers?

Mixpanel treats numbers... as numbers

There are lots of uses for sending numbers to Mixpanel, especially in Segmentation reports.

Let's say you were instrumenting a music sharing site, and with every “song played” event you sent a property that recorded the length of the song in seconds. Let's call this property "Length". If you send the property as an integer or decimal (122 or 3.45), Mixpanel is pretty smart and will detect it as a number!

Your event call and the associated "Length" property could look something like this:

mixpanel.track("Song Played",{"Length":122});

Build histograms to review the distribution of your data

Building a histogram is an excellent way to see how your data is distributed. How many times are long songs being played? Building a histogram is as simple as opening a segmentation report and choosing the "song played" event then segmenting based on your numeric "Length" property.

Here's an example of such a histogram. You can see the distribution of the length of all songs which have been played on my app:

histogram

It looks like there is no dominant song length in this data!

Dive deeper into your data with filters

Maybe you only care about how many times people play long songs. To dig deeper into this data, you can select certain subsets by filtering with greater than or less than operators. To better understand the distribution of long songs and develop a more granular report, use the "Length" property as a filter!

So, how many times are songs between 160 and 200 seconds being played?

big songs

There seem to be relatively few songs at 168 and 182 seconds.

Averages, Maxes and Mins (oh my!)

Seeing how many long songs your customers play may be useful, but what if you wanted to know what the typical length of a song played is? Sounds like you need an average! To calculate averages, instead of applying a filter or creating a histogram, you can change the 'BY' drop-down to 'AVG'. In a time-series, this will show how your average song length fluctuates over time. Use this same drop down to investigate changes in mins, maxes and totals as well!

average songs

Relabel your properties by typecasting

Sometimes--though not often--Mixpanel might miss that the property you are sending is in fact a number. If you are sending a property as a number but Mixpanel is not detecting it as a number, you can typecast it by selecting the typecasting drop down and selecting the Number option.

average songs

Related: What data types does Mixpanel accept as properties?