Return to dashboard Getting started - In less than 10 minutes.

Custom event tracking

Event tracking is the most basic service you get from Mixpanel. All the places users interact with your website - such as sending messages, playing songs, or battling each other - can be tracked with Mixpanel.

1
Add our javascript snippet to your page

Place this code right before the </body> tag.

Copied!

2
Track an event in one line of code

mpmetrics.track("Sign up");

If you are a Facebook Connect user, you probably want to track the number of items that you publish to your users' streams.

3
Advanced: Properties

Properties are a way to include extra data about the event or the user. If you were tracking a 'Play song' event, you could include the genre of the song and the gender of the user with your event.

Including properties with your events is really easy - they are just key-value pairs.

mpmetrics.track('Play song', { 'genre': song.genre, 'gender': user.gender });

To learn more, check out the documentation for properties.

Return to dashboard
Powered by Olark