Filter Employee or Internal User Actions

This article reflects the behavior of an older version of Mixpanel's identity management system without Identity Merge enabled.

Data sent to Mixpanel can be differentiated from data sent by teammates testing or using a product and actual end users. Building this distinction depends largely on the nature of the product, and the desired division between teammate activity vs. your user activity present in the data.

Continue to Collect Data, but Filter Out of Reports by Email

One way to build reports that exclude teammate or employee activity is to filter out data where the Email property contains your company domain.

The process is similar across Mixpanel reports.

For example, this can be reflected in an Insights report by:

1. Click the Filter button.


2. Specify the Email property.


3. Select Does not contain and specifying the domain of the group to be excluded.


4. Select Add filter.

5. Additional filters can then be added for additional granularity.


Create Separate Projects for Development and Production

Keeping data sets separate is important to maintain the integrity of the metrics you're tracking with Mixpanel. It's very easy to prevent these data sets from co-mingling, but hard to detangle.

To set up this environment:

1. Create two separate Mixpanel projects for Development and Production. (Mixpanel doesn't limit the number of projects you can use).

2. Use the logic in the code snippet below to switch automatically between the two project tokens when you're in development or when you're ready to push data to production.

3. Specify your production domain and project tokens

Dynamically changing project tokens ensure that your testing data does not contaminate your production environment allowing you to easily build reports off of true user data. Plus, it removes the need to swap out tokens before every push to production. 

The code snippet below is for a JavaScript implementation. You can include similar logic in your Mixpanel Android, iOS and server-side code.

Note: Use this solution only if your development environment uses a different hostname, such as 

var productionHost = 'Your production Domain';
var devToken = 'Development Token';
var prodToken = 'Production Token';
//If the hostname is anything other than your production domain, initialize the Mixpanel library with your Development Token
if (window.location.hostname.toLowerCase().search(productionHost) < 0) {
} else {

Opt Individuals Out of Tracking in a Single Project (Web or Mobile)

Mixpanel’s client-side tracking library contains the opt_out_tracking() method, which will set the user’s local opt-out state to “true” and will prevent data from being sent from a user’s device. More detailed instructions can be found in our developer documentation.

This will prevent data from being sent out from the user’s browser or app going forward, but it will not remove past events that were already sent in before this method was implemented. It will also not prevent any data related to the user from being sent from other platforms.

Did this answer your question?



Article is closed for comments.