Skip to main content

Overview

Events are the foundation of Mixpanel analytics. They represent user actions or occurrences in your product. This section will teach you two ways to capture events:
  1. Track Events - Manually track specific user actions
  2. Autocapture - Automatically capture common interactions

Choose Your Approach

Track Events

Manually track specific user actions with custom properties

Autocapture

Automatically capture clicks, page views, and more (JavaScript only)

Track Events

The track method allows you to manually track user actions. This gives you full control over what events are tracked and what properties are included.

When to Use Track Events

  • Tracking specific business-critical actions (e.g., “Purchase Completed”, “Video Watched”)
  • Including custom properties with events
  • Working with server-side SDKs
  • Need precise control over event data

Basic Example

mixpanel.track('Sign Up', {
  'Signup Type': 'Referral',
  'Plan': 'Premium'
})
Learn more about tracking events →

Autocapture

Autocapture automatically tracks common user interactions without requiring manual instrumentation. This is only available for the JavaScript SDK.

When to Use Autocapture

  • Quick setup without extensive code changes
  • Capturing general user behavior patterns
  • Tracking clicks, page views, and form submissions automatically
  • Complementing your manual event tracking

Basic Example

mixpanel.init('YOUR_PROJECT_TOKEN', {
  autocapture: true
});
Learn more about autocapture →

Best Practices

Start with key events: Focus on tracking 5-10 critical user actions that align with your business goals.
Use consistent naming: Establish a naming convention for events (e.g., “Verb + Noun” like “Video Played” or “Article Viewed”).
Add meaningful properties: Include contextual information that will help you analyze events later.
Avoid tracking sensitive data: Never track passwords, credit card numbers, or other personally identifiable information (PII) unless required.
Depending on your product type, here are some common events to consider:

SaaS Products

  • Sign Up
  • Sign In
  • Trial Started
  • Feature Used
  • Upgrade
  • Invitation Sent

E-commerce

  • Product Viewed
  • Add to Cart
  • Checkout Started
  • Purchase Completed
  • Product Reviewed

Content Platforms

  • Article Viewed
  • Video Played
  • Comment Posted
  • Content Shared
  • Search Performed

Mobile Apps

  • App Opened
  • Screen Viewed
  • Push Notification Received
  • In-App Purchase
  • Share

Combining Both Approaches

For the best results, many teams use both methods:
  1. Use Autocapture for general user behavior and quick insights
  2. Use Track Events for business-critical actions with specific properties
This hybrid approach gives you comprehensive coverage without requiring extensive manual instrumentation.

Next Steps

1

Set Up Track Events

Start by implementing manual tracking for your most important user actionsTrack Events Guide →
2

Enable Autocapture (Optional)

Add autocapture to capture additional interactions automaticallyAutocapture Guide →
3

Test Your Implementation

Verify events are flowing into Mixpanel correctlyView Events in Mixpanel →

FAQ

Use both! Autocapture is great for getting started quickly and capturing general behavior. Track Events gives you precise control for business-critical actions. Most teams use Autocapture as a foundation and add manual tracking for their most important events.
Start small with 5-10 key events that align with your business goals. You can always add more later. Tracking too many events from the start can make analysis overwhelming.
Include properties that will help you answer questions about your product. For example:
  • Event context (e.g., which screen, which feature)
  • User attributes (e.g., plan type, account age)
  • Business metrics (e.g., price, quantity)
Avoid tracking sensitive data or high-cardinality values (like timestamps or random IDs).
While you technically can, it’s better to establish good naming conventions from the start. Changing event names requires updating your code and can make historical analysis difficult. Use the Lexicon feature to add descriptions and hide unused events instead.

Build docs developers (and LLMs) love