Docs
Choosing the Right Method

Choosing the Right Method

If you use our SDKs, there are two general approaches to track events: client-side and server-side. The approach you choose has implications on the quality and comprehensiveness of your data.

We recommend tracking everything you possibly can via your servers, and only supplementing that with client-side tracking when necessary.

Note: If you already track events via a CDP, Tag Manager, or via your DWH using something like Snowplow, you can route those events to Mixpanel with our native integrations. See the Segment (opens in a new tab), Rudderstack (opens in a new tab), or GTM (opens in a new tab) docs for a walkthrough. We can also load data directly from data warehouses like Snowflake and BigQuery.

client-side vs server-side

Server-Side Tracking

In this method, you send events from your servers to Mixpanel. For example, when a user loads a web page, a request is made to your web application server. In the code that handles the request, you can create a "Page Loaded" event and send it to Mixpanel. You can use one of our server SDKs (eg: Python) or send events to our HTTP API (opens in a new tab) directly. Please see this article on best practices for server-side tracking.

Pros

  • Reliable, not susceptible to ad-blockers
  • Data is consistent across platforms
  • Easier to fix integration mistakes quickly

Cons

  • Harder to track user interactions that only happen on the client
  • Requires some custom code to track anonymous (non-logged in) users across requests

Server-Side SDKs

Client-Side Tracking

In this method, events are generated on the client device and sent to the Mixpanel API. There are two types of client-side tracking: web (Javascript) and mobile.

Pros

  • Easy to track client-side actions and state
  • Easy to track anonymous (non-logged in) user data

Cons

  • Unreliable, due to ad-blockers. You may lose events for 30-50% of your users. You can resolve this by sending events through a proxy, but it requires a bit more effort
  • Difficult to keep metrics consistent across web, iOS, and Android since each requires its own tracking
  • Difficult to fix integration mistakes quickly (particularly on mobile applications)
  • Tracking will diverge over time due to old mobile clients

Client-Side SDKs

Note: Mixpanel client-side SDK uses /track API endpoint (opens in a new tab) which by default only ingests events in the last 5 days.

Client-Side Tracking via a Proxy

A proxy is helpful in a client-side web setting to reduce the likelihood of ad-blockers impacting your tracking (opens in a new tab). Please see this article on how to set up a proxy.

Was this page useful?