Distinct IDs

Mixpanel’s distinct_id is a unique identifier that is connected to every event as an event property.

A distinct_id is assigned to every user that is tracked, and it connects all of the events performed by an individual user.  

Mixpanel’s client-side tracking libraries automatically assign a distinct_id to a user when they first visit a website or an application that has Mixpanel installed.

Distinct_ids can and often should be sent in server-side implementations as well.

Distinct_id Role in Reports

The distinct_id plays an important role in determining event count.

While the role that distinct_ids play in building reports does vary, it is always used to tie events to an individual user. The distinct_id is part of calculations in the following reports:

Insights, Segmentation, and Formulas

In the Insights, Segmentation, and Formulas reports distinct_ids are used to determine uniqueness.

When you filter a report down to look at only uniques, Mixpanel is showing you the count of unique distinct_id values that triggered that event.

When you view averages, it is showing you the average number of events sent per distinct_id per hour/day/week/month.

Funnels

In the Funnels report, distinct_id is used to follow a given customer through a funnel.

When the report is calculated, we take the count of unique distinct_id values that sent the first event.

We then follow that pool of ids through the subsequent events, calculating the drop off as we go.

Retention

In the Retention report, distinct_id is used to follow a cohort of users through time.

When you select a value under "show me users who did X," we collect the entire pool of unique distinct_id values that send that event on the given day/week/month.

We then follow that group of distinct_ids forward in time to see if there are any the events you specified in the following day/week/month long buckets that were sent with that id. If so, we include that id when calculating the percentage that we display for that cell in the chart.

People Analytics 

Distinct_ids play a dual role in people analytics.

Each people profile is indexed by a unique distinct_id, which represents the identity of the user.

People data sent to Mixpanel must include a distinct_id.

If the distinct_id already exists in Mixpanel and has a people profile tied to it, then the incoming people data updates the existing profile.

If the distinct_id does not already exist, a new people profile is created for that distinct_id.

Locating the Distinct_id

Distinct_ids can be obtained in several different reports within Mixpanel.

Explore

Mixpanel’s Explore report aggregates and organizes a collection of People profiles.

The distinct_id is used to both distinguish profiles from one another and to tie events to People profiles.

All events and associated properties that a user performs will be visible in the activity feed.

The distinct_id of a user that performs an event can therefore be obtained from the Explore report.

To view distinct_ids from Explore:

1- Under "Users" click Explore.

Screen_Shot_2018-05-10_at_2.34.20_PM.png

2- Select a people profile.

Screen_Shot_2018-05-10_at_2.58.48_PM.png

3- The distinct_id of that user will be visible in the URL of that User Profile.

Screen_Shot_2018-05-11_at_10.09.07_AM.png

Live View

Live view displays events that are being collected by Mixpanel in real time.

Every event and all of its corresponding properties can be examined in Live View, including the distinct_id associated with every event.

To view distinct_ids from Live View:

1- Under "Analysis" click Live View.

Screen_Shot_2018-05-10_at_2.33.57_PM.png

2- Select an event. View the "Distinct ID" column.

Screen_Shot_2018-05-10_at_2.48.11_PM.png

Bulk Identification of Users

There are many instances where it is necessary to obtain the distinct_ids of a collection of users.

JQL and the Mixpanel export API can be used to collect distinct_ids in bulk based on another identifier (such as a people property).

JQL

To view or export distinct_ids in bulk, you can leverage JQL, which can be used to query your raw event and people data.

Distinct_ids can be returned with a value, such as email address, by using a query similar to the one in the example below:

// Returns a list of values of distinct_ids and another property
function main() {
 return join(
  Events({
   from_date: '2018-04-21',
   to_date:   '2018-04-22'
  }), 
  People()
  )
//return only users for which the property is set
 .filter(function(j) {return j.user && j.user.properties.$email})
// group the data by distinct_id, and optionally any other properties
 .groupByUser(["user.properties.$email"], mixpanel.reducer.count())
// return only the distinct_ids, and optionally any other properties
 .map(function(i){
  return {
  "distinct_id": i.key[0],
  "Email": i.key[1]
  };
 });
}

Use the query below to return only a list of distinct_ids that have fired any event for a particular date range:

// Returns a list of distinct_ids
function main() {
    return Events({
        from_date: '2018-04-21',
        to_date: '2018-04-22'
    })
    .groupBy(['properties.$distinct_id'], mixpanel.reducer.null())
    .map(function(m) {
        return {
            "distinct_id" : m.key[0]
        };
     });
}
Is this article helpful?
10 out of 30 found this helpful

Comments

0 comments

Article is closed for comments.