Skip to main content
GET
/
api
/
analytics
Analytics
curl --request GET \
  --url https://api.example.com/api/analytics \
  --header 'Content-Type: application/json' \
  --data '
{
  "event": "<string>",
  "project_id": "<string>",
  "flow_id": "<string>",
  "device_id": "<string>",
  "properties": {},
  "timestamp": "<string>"
}
'
{
  "success": true,
  "data": {
    "summary": {
      "total_users": 15420,
      "new_users": 1234,
      "returning_users": 14186,
      "total_flows_started": 18650,
      "total_flows_completed": 14174,
      "overall_completion_rate": 0.76,
      "avg_completion_time_seconds": 45
    },
    "trends": {
      "users_change": 0.15,
      "completion_rate_change": 0.03,
      "avg_time_change": -0.05
    },
    "top_flows": [
      {
        "flow_id": "flow_abc123",
        "flow_name": "Default Onboarding",
        "starts": 12450,
        "completions": 9782,
        "completion_rate": 0.786
      }
    ],
    "platforms": {
      "ios": {
        "users": 8234,
        "completion_rate": 0.78
      },
      "android": {
        "users": 7186,
        "completion_rate": 0.74
      }
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://muchadostudio.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Get Analytics Overview

Get analytics summary for a project.
project_id
string
required
The project ID to get analytics for
date_from
string
required
Start date in YYYY-MM-DD format
date_to
string
required
End date in YYYY-MM-DD format
timezone
string
default:"UTC"
Timezone for date calculations (e.g., America/New_York)
{
  "success": true,
  "data": {
    "summary": {
      "total_users": 15420,
      "new_users": 1234,
      "returning_users": 14186,
      "total_flows_started": 18650,
      "total_flows_completed": 14174,
      "overall_completion_rate": 0.76,
      "avg_completion_time_seconds": 45
    },
    "trends": {
      "users_change": 0.15,
      "completion_rate_change": 0.03,
      "avg_time_change": -0.05
    },
    "top_flows": [
      {
        "flow_id": "flow_abc123",
        "flow_name": "Default Onboarding",
        "starts": 12450,
        "completions": 9782,
        "completion_rate": 0.786
      }
    ],
    "platforms": {
      "ios": {
        "users": 8234,
        "completion_rate": 0.78
      },
      "android": {
        "users": 7186,
        "completion_rate": 0.74
      }
    }
  }
}

Get Flow Analytics

Get detailed analytics for a specific flow.
flow_id
string
required
The flow ID to analyze
date_from
string
required
Start date in YYYY-MM-DD format
date_to
string
required
End date in YYYY-MM-DD format
group_by
string
default:"day"
Group results by: hour, day, week, month
{
  "success": true,
  "data": {
    "flow": {
      "id": "flow_abc123",
      "name": "Default Onboarding"
    },
    "summary": {
      "total_starts": 5420,
      "total_completions": 4120,
      "completion_rate": 0.76,
      "unique_users": 5200,
      "avg_completion_time_seconds": 45,
      "median_completion_time_seconds": 42
    },
    "time_series": [
      {
        "date": "2024-01-20",
        "starts": 342,
        "completions": 260,
        "unique_users": 320,
        "completion_rate": 0.76
      }
    ],
    "funnel": [
      {
        "screen_id": "screen_1",
        "screen_name": "Welcome",
        "users": 5420,
        "drop_off": 200,
        "drop_off_rate": 0.037
      },
      {
        "screen_id": "screen_2",
        "screen_name": "Features",
        "users": 5220,
        "drop_off": 450,
        "drop_off_rate": 0.086
      }
    ],
    "user_segments": {
      "by_platform": {
        "ios": { "users": 2890, "completion_rate": 0.78 },
        "android": { "users": 2530, "completion_rate": 0.74 }
      },
      "by_country": {
        "US": { "users": 2100, "completion_rate": 0.77 },
        "GB": { "users": 890, "completion_rate": 0.79 },
        "other": { "users": 2430, "completion_rate": 0.75 }
      }
    }
  }
}

Get Screen Analytics

Get analytics for a specific screen.
screen_id
string
required
The screen ID to analyze
date_from
string
required
Start date
date_to
string
required
End date
{
  "success": true,
  "data": {
    "screen": {
      "id": "screen_123",
      "name": "Welcome Screen",
      "type": "welcome"
    },
    "metrics": {
      "total_views": 5420,
      "unique_viewers": 5200,
      "avg_time_seconds": 12,
      "median_time_seconds": 10,
      "bounce_rate": 0.037,
      "interaction_rate": 0.92
    },
    "interactions": {
      "continue_button": 4920,
      "skip_button": 200,
      "back_button": 50
    },
    "exit_reasons": {
      "completed": 4920,
      "skipped": 200,
      "abandoned": 300
    }
  }
}

Track Event

Track a custom analytics event. This endpoint is used by SDKs to track onboarding events.
The mobile SDKs automatically track events. This endpoint is documented for custom integrations.
event
string
required
Event name: flow_started, step_viewed, flow_completed
project_id
string
required
The project ID
flow_id
string
required
The flow ID
device_id
string
required
Unique device identifier
properties
object
Additional event properties
timestamp
string
ISO 8601 timestamp (defaults to current time)
{
  "success": true,
  "message": "Event tracked successfully"
}

Export Analytics

Export analytics data in various formats.
project_id
string
required
The project ID
date_from
string
required
Start date
date_to
string
required
End date
format
string
default:"json"
Export format: json, csv, xlsx
include
array
Data to include: summary, flows, screens, events, users
{
  "success": true,
  "data": {
    "export_url": "https://onboardsync.vercel.app/exports/analytics_abc123.csv",
    "expires_at": "2024-01-26T12:00:00Z",
    "size_bytes": 45678
  }
}

Real-time Analytics

Get real-time analytics data (last 5 minutes).
project_id
string
required
The project ID
{
  "success": true,
  "data": {
    "active_users": 42,
    "flows_in_progress": 38,
    "recent_completions": 12,
    "recent_events": [
      {
        "event": "flow_started",
        "flow_name": "Default Onboarding",
        "timestamp": "2024-01-25T12:34:56Z",
        "platform": "ios"
      }
    ],
    "completion_rate_5min": 0.82
  }
}

A/B Test Results

Get results for an A/B test between flows.
test_id
string
required
The A/B test ID
confidence_level
number
default:"0.95"
Statistical confidence level (0.90, 0.95, 0.99)
{
  "success": true,
  "data": {
    "test": {
      "id": "test_xyz789",
      "name": "Onboarding Length Test",
      "status": "running",
      "started_at": "2024-01-15T00:00:00Z"
    },
    "variants": [
      {
        "flow_id": "flow_control",
        "name": "Control (5 screens)",
        "users": 2500,
        "completions": 1900,
        "completion_rate": 0.76,
        "confidence_interval": [0.74, 0.78]
      },
      {
        "flow_id": "flow_variant",
        "name": "Variant (3 screens)",
        "users": 2500,
        "completions": 2050,
        "completion_rate": 0.82,
        "confidence_interval": [0.80, 0.84],
        "improvement": 0.079,
        "is_significant": true
      }
    ],
    "recommendation": "The variant shows a statistically significant 7.9% improvement in completion rate.",
    "sample_size_needed": 2000,
    "current_power": 0.95
  }
}

Code Examples

// Get weekly analytics summary
async function getWeeklyAnalytics(projectId) {
  const endDate = new Date();
  const startDate = new Date();
  startDate.setDate(startDate.getDate() - 7);

  const params = new URLSearchParams({
    project_id: projectId,
    date_from: startDate.toISOString().split('T')[0],
    date_to: endDate.toISOString().split('T')[0],
    timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
  });

  const response = await fetch(
    `https://onboardsync.vercel.app/api/analytics?${params}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  return response.json();
}

// Track custom event
async function trackCustomEvent(eventData) {
  const response = await fetch(
    'https://onboardsync.vercel.app/api/analytics/events',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        event: 'custom_action',
        project_id: 'proj_xyz789',
        flow_id: 'flow_abc123',
        device_id: 'device_unique123',
        properties: {
          action_type: 'button_click',
          button_id: 'continue_btn',
          screen_id: 'screen_welcome'
        }
      })
    }
  );

  return response.json();
}

// Export analytics to CSV
async function exportAnalytics(projectId, startDate, endDate) {
  const params = new URLSearchParams({
    project_id: projectId,
    date_from: startDate,
    date_to: endDate,
    format: 'csv',
    include: ['summary', 'flows', 'screens']
  });

  const response = await fetch(
    `https://onboardsync.vercel.app/api/analytics/export?${params}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const data = await response.json();
  
  // Download the file
  window.open(data.data.export_url, '_blank');
}