Docs
Tracking
Server

Server

You can use Mixpanel's Server SDKs to send events from your backend servers to Mixpanel. We recommend server-side tracking, since it is more reliable and easier to maintain than web/mobile tracking.

Step 1: Install the SDK

pip install mixpanel

Step 2: Track your first event

You'll need your Project Token for this, which you can get here (opens in a new tab).

from mixpanel import Mixpanel
 
mp = Mixpanel("YOUR_TOKEN")
 
# Note: you must supply the user_id who performed the event as the first parameter.
mp.track(user_id, 'Signed Up',  {
  'Signup Type': 'Referral'
})

🎉 Congratulations, you've tracked your first event! You can see it in Mixpanel via the Events (opens in a new tab) page.

Don't see your language here? See all our libraries in Github (opens in a new tab) and our references for Python, Node, Go, Ruby, and Java. We also have a simple HTTP API for any languages we don't support.