6 min read

How to Track Custom Alerts in Mixpanel

When your app sends alerts—price changes, inventory warnings, performance thresholds—you need to know if users see them and act on them. Tracking custom alerts in Mixpanel gives you visibility into alert reach, engagement, and ROI. Without it, you're blind to whether your notification system drives conversions or gets ignored.

Set up custom alert event tracking

Start by defining a clear event structure so you can segment alerts by type, severity, and source.

Track alert triggers with essential properties

Fire an Alert Triggered event when your app sends an alert. Include alert_type (price_change, inventory, performance), severity (critical, warning, info), and alert_source (system, user_rule, anomaly). These properties let you segment and compare alert effectiveness later in Mixpanel's Segmentation or Funnels.

javascript
mixpanel.track('Alert Triggered', {
  alert_type: 'price_change',
  severity: 'critical',
  alert_source: 'user_rule',
  product_id: '12345',
  price_change_percent: 15.5,
  recipient_count: 243,
  timestamp: new Date().toISOString()
});
Track alert events with type, severity, and distribution metrics

Add identifiers and context to track alert flow

Include alert_id (unique identifier for this alert instance), user_segment (who was targeted: enterprise, trial, inactive), and channel info (alert_channel: email, push, in_app). This lets you ask: 'Do enterprise users engage with critical alerts more than free users?'

javascript
const alertData = {
  alert_id: `alert_${Date.now()}_${Math.random()}`,
  alert_type: 'inventory_warning',
  severity: 'warning',
  user_segment: 'enterprise',
  alert_channel: 'email',
  threshold_value: 10,
  actual_value: 5,
  sku: 'PROD-987'
};

mixpanel.track('Alert Triggered', alertData);
Include unique IDs and user context to analyze alert reach across segments
Watch out: Keep properties to 10–15 that map to real business questions. Extra properties add noise and slow down segmentation filters. Stick to alert_type, severity, and channel.

Track user responses to alerts

Alerts only work if users see and act on them. Log separate events for viewing, dismissing, and acting.

Log when users view or open alerts

When a user clicks an email, views an in-app notification, or scrolls to a banner, fire an Alert Viewed event. Use the same alert_id and alert_type to link it back to the trigger event. Mixpanel automatically calculates the funnel drop-off rate: (viewed / triggered) × 100.

javascript
function onAlertViewed(alertId, alertType) {
  mixpanel.track('Alert Viewed', {
    alert_id: alertId,
    alert_type: alertType,
    view_device: navigator.userAgent.includes('Mobile') ? 'mobile' : 'desktop',
    time_since_trigger: calculateSecondsSinceTrigger(alertId),
    view_duration_seconds: 0
  });
}

// Example: user opens price alert email
onAlertViewed('alert_1710008400123_abc', 'price_change');
Track alert opens with device and timing context

Capture alert actions to measure effectiveness

Log distinct events for different user responses: Alert Actioned, Alert Dismissed, Alert Snoozed. For actioned alerts, include action_type (purchased_item, updated_rule, contacted_support) and time_to_action in seconds. This reveals if your alerts drive intended behavior.

javascript
// When user acts on alert
mixpanel.track('Alert Actioned', {
  alert_id: 'alert_1710008400123_abc',
  alert_type: 'price_change',
  action_type: 'purchased_product',
  time_to_action: 87,
  order_value: 299.99,
  conversion_attributed: true
});

// When user dismisses alert
mixpanel.track('Alert Dismissed', {
  alert_id: 'alert_1710008400456_xyz',
  alert_type: 'inventory_warning',
  dismissal_reason: 'not_relevant',
  time_to_dismiss: 5
});
Log conversions and dismissals separately to measure alert quality

Update user properties for alert frequency analysis

Use mixpanel.people.set() to track alert exposure at the user level. Set properties like last_alert_received, alerts_this_month, and frequent_alert_recipient. This enables retention cohorts and segmentation: 'Do users who receive more alerts have better retention?'

javascript
// After sending alert, update user properties
mixpanel.people.set({
  'last_alert_received': new Date().toISOString(),
  'alerts_this_month': (previousCount || 0) + 1,
  'last_alert_type': 'price_change',
  'last_alert_severity': 'critical',
  'high_frequency_alert_user': (previousCount || 0) + 1 >= 5
});

// Now in Mixpanel, filter users by "alerts_this_month >= 10" for cohort analysis
Set user properties to enable alert-based segmentation and retention cohorts
Tip: Use Funnels to chain Alert Triggered → Alert Viewed → Order Placed. Compare funnel conversion rates between critical and info severity alerts—critical should convert higher or it's noise.

Analyze and optimize alerts in Mixpanel dashboards

With alerts tracked, measure ROI and identify which alert types drive user behavior.

Build segmentation reports by alert type and severity

Go to Analytics > Segmentation, select Alert Triggered as the event, and segment by alert_type and severity. This shows alert volume distribution. Then add a filter for Alert Viewed to calculate view-through rate by type. Critical price alerts should have higher view rates than info-level alerts.

javascript
// In Mixpanel UI, configure Segmentation:
// Event: "Alert Triggered"
// Segment by: "properties[alert_type]" (breakdown: price_change, inventory, performance)
// Secondary segment by: "properties[severity]" (breakdown: critical, warning, info)
// Filter: "Alert Viewed" is not null
// Result: View-through rates by alert type and severity

// Or query via Mixpanel Data Export API:
// GET https://data.mixpanel.com/api/2.0/segmentation
// with params: event="Alert Triggered", on="properties[alert_type]", unit="day"
Use Segmentation to compare alert effectiveness by type and severity

Compare retention for alert recipients vs. non-recipients

Use Analytics > Retention to build cohorts. Cohort A: users with high_frequency_alert_user: true in the past 30 days. Cohort B: everyone else. If Cohort A has better day-7 retention, alerts drive stickiness. If worse, they're damaging engagement.

javascript
// In Mixpanel Retention cohort analysis:
// Cohort 1: Where "alerts_this_month" >= 5
// Cohort 2: Where "alerts_this_month" < 5
// Event: "Session Started"
// Time interval: Days
// Measure: Day 1, Day 7, Day 30 retention
// If Cohort 1 retention > Cohort 2, alerts improve stickiness

// SDK code to enable this:
mixpanel.people.set({
  'alerts_this_month': count,
  'last_alert_severity': severity
});
Cohort retention analysis to measure alert impact on user stickiness
Tip: Create a custom Dashboard pinning Alert Triggered, Alert Viewed, Alert Actioned, and alert view-through rate as cards. Update it daily to spot alert quality regressions fast.

Common Pitfalls

  • Tracking Alert Triggered without properties (no type, no severity). You'll see total alert volume but can't segment by what matters, making optimization impossible.
  • Only tracking triggers, not views or actions. An email sent ≠ an email opened. Without Alert Viewed, your view-through rates are unknown and you can't measure engagement.
  • Using vague property values like alert_type: 'other' or severity: 'medium'. Use strict enums (price_change, inventory, performance; critical, warning, info) so Segmentation filters are clean.
  • Forgetting user properties like alerts_this_month or last_alert_severity. Without them, you can't segment users by alert exposure in Retention or compare cohort behavior.

Wrapping Up

Tracking custom alerts in Mixpanel transforms notifications from a blind feature into a measurable driver of user behavior. By logging triggers, views, actions, and user exposure, you uncover which alerts matter (critical price changes drive conversions) and which are noise (info alerts get ignored). If you want to automate alert tracking and sync it across your analytics, CRM, and product stack, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free