Mixpanel Cheat Sheet

Mixpanel is an analytics platform that allows businesses to analyze user behavior on their websites and mobile apps. Here’s a cheat sheet with some common tasks and commands in Mixpanel:

Events

Track Event:

  • Use the track method to log events.
mixpanel.track('Event Name');

Track Event with Properties:

  • Include additional properties with the event.
mixpanel.track('Event Name', { property1: 'value1', property2: 'value2' });

Alias User:

  • Associate a user with a unique identifier.
mixpanel.alias('new_id');

User Properties

Set User Properties:

  • Set properties for a user.
mixpanel.people.set({ $name: 'John Doe', $email: '[email protected]' });

Increment User Property:

  • Increment a numeric property for a user.
mixpanel.people.increment('App Opens');

Funnel Analysis

Create Funnel:

  • Define a funnel with multiple steps.
mixpanel.set_funnel(['Step 1', 'Step 2', 'Step 3']);

Track Funnel Step:

  • Log events for each step in the funnel.
mixpanel.track('Step 1');

Retention Analysis

Set Retention Date:

  • Set the date for retention analysis.
mixpanel.set_retention_date('2022-01-01');

Get Retention Data:

  • Retrieve retention data for a specific cohort.
mixpanel.get_retention({ cohort_id: 'Cohort ID' });

Segmentation

Segmentation Query:

  • Query user data based on conditions.
mixpanel.segmentation('properties["Country"] == "US"');

A/B Testing

Start A/B Test:

  • Start an A/B test with variations.
mixpanel.start('Test Name', 'Variation A', 'Variation B');

Track A/B Test Variation:

  • Log events specific to each variation.
mixpanel.track('Test Variation A Event');

Export Data

  • Export Data:
    • Retrieve data using Mixpanel’s Data Export API.
curl -u YOUR_API_KEY: "https://data.mixpanel.com/api/2.0/export/"

Additional Tips

  • Integrate Mixpanel SDK:
    • Integrate the Mixpanel SDK into your web or mobile app.
  • Explore Mixpanel Documentation:
    • Refer to the Mixpanel documentation for detailed information on features and methods.
  • Mixpanel Console:
    • Utilize the Mixpanel console for real-time data exploration.
  • Set Project Token:
    • Ensure your project token is set in the Mixpanel initialization.

This cheat sheet covers some common tasks and commands in Mixpanel. Adjust these examples based on your specific requirements and the programming language you are using. Mixpanel provides powerful analytics capabilities to understand user behavior and improve your product.