Track Events
Overview
This step introduces the track
method, which allows you to see how your users are using your product.
Use the track method to track events on behalf of your users. Add this code snippet to basic events like "Sign Up" and any additional events that may track the core features of your product.
Code
Replace Sign Up
with a unique identifier for the event. Passing additional information is possible using the properties object.
mixpanel.track('Sign Up', {
'Signup Type': 'Referral'
})
🎉 Congratulations, you've tracked your first event! You can see it in Mixpanel via the Events page (opens in a new tab).
More resources:
You're Ready to Start Using Mixpanel
It's time to create your first report or use one of our many templates.
FAQ
Does Mixpanel automatically track page views?
Yes, if you pass track_pageview: true
in the mixpanel.init()
call,
Mixpanel will automatically track a "Page View" event every time a new
page is loaded.
Learn more here.
Why aren't my events showing up?
If tracking from the web, make sure you've disabled ad blockers and your Do Not Track (DNT) browser settings are set to false when testing your JavaScript implementation. If the DNT setting is set to true, then Mixpanel won't collect information from that Mixpanel instance. We also recommend setting up a proxy server so that you don't lose events due to ad-blockers.
If tracking from a mobile device, events may take 1-2 minutes to appear because Mixpanel's
mobile SDKs buffer events for 1 minute, or when the app transitions to the background, to
conserve battery life and bandwidth. You can call .flush()
in the mobile SDKs to manually flush events to Mixpanel.
Was this page useful?