Examples of Incremental Super Properties

  • 30 October 2019
  • 0 replies
Examples of Incremental Super Properties
Userlevel 5
Badge +4

Every week, we will release tips to help you get the most out of Mixpanel. Want to see more? Click here to see other #mpknowledgedrop articles!


Creating incremental properties can help you tally how often a user takes specific actions on your site or in your app. The following code block is an example of a super property implemented in a web-based JavaScript application.

//wait until Mixpanel is loaded
//alternatively you may use the loaded callback in the init() or set_config(): //
function waitUntilLoad(func) {
if (mixpanel.__loaded) func();
else setTimeout(function() {
}, 10);

//a wrapper which acts a superIncrement method accepting a 'property' and 'amount'
function superIncrement(property, amount) {
waitUntilLoad(function() {
superIncrementLogic(property, amount);

//increment the user property and setup the event incrementory
function superIncrementLogic(property, amount) {
increment(property, amount);
mixpanel.people.increment(property, amount); //comment this line out if you do not wish to add a 'user profile property'

//wrapper for the incremental event logic
function increment(property, value) {
waitUntilLoad(function() {
incrementLogic(property, value);

//the actual increment logic
function incrementLogic(property, value) {
var prop = {};
prop[property] = 0;
prop[property] = mixpanel.get_property(property) + value;

// Track an event called 'Read Article' with a super/user prop for '# of article read'
superIncrement('# of articles read', 1)
mixpanel.track('Read Article')

For more information on Incremental Super Properties for Events, please take a look at this Event Properties help article.


0 replies

Be the first to reply!