> For the complete documentation index, see [llms.txt](https://docs.flutfast.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flutfast.com/analytics-mixpanel.md).

# Analytics (Mixpanel)

## Mixpanel Event Tracking Documentation

This file contains functions to track various events using Mixpanel.

### Initialization

Mixpanel must be initialized with your project token before using the tracking functions.

### Functions

#### `trackEvent(eventName: string, userId: string, properties?: Record<string, any>): void`

This function tracks a custom event with Mixpanel. It requires the event name, user ID, and optionally additional properties.

#### `trackSignedUp(userId: string, signupType: string, plan: string): void`

Tracks the event when a user signs up for the application. Requires the user ID, signup type, and plan chosen by the user.

#### `trackLoggedIn(userId: string, loginMethod: string): void`

Tracks the event when a user logs in to the application. Requires the user ID and the method used for login.

#### `trackProductViewed(userId: string, productId: string, category: string): void`

Tracks the event when a user views a product. Requires the user ID, product ID, and category of the product.

#### `trackItemAddedToCart(userId: string, productId: string, quantity: number): void`

Tracks the event when a user adds an item to their shopping cart. Requires the user ID, product ID, and quantity added.

#### `trackOrderCompleted(userId: string, orderId: string, totalAmount: number, paymentMethod: string): void`

Tracks the event when a user completes an order. Requires the user ID, order ID, total amount of the order, and payment method.

#### `trackPageViewed(userId: string, pageUrl: string, pageTitle: string): void`

Tracks the event when a user views a specific page. Requires the user ID, URL, and title of the page.

These functions can be used to track user interactions and behaviors within your application using Mixpanel.
