A data-driven conversion and analytics dashboard built with Next.js. Track user events, analyze conversion funnels, compare A/B test variants, and view trends over time. Features raw event viewer with pagination, funnel drop-off analysis, variant performance metrics, and time-series visualizations using Recharts.
- Raw Events Viewer - Browse and filter event data with pagination support
- Funnel Analysis - Track user progression through conversion steps with drop-off metrics
- A/B Testing - Compare performance between variant A and B
- Trends - Visualize metrics over time with interactive charts
- Framework: Next.js 15
- UI Library: React 19
- Styling: Tailwind CSS
- Charts: Recharts
- Language: TypeScript
- Database: JSON (file-based)
- Node.js 18+
- npm or yarn
# Install dependencies
npm install
# Generate sample event data
npm run generate-data
# Start development server
npm run devOpen http://localhost:3000 in your browser.
├── app/
│ ├── layout.tsx # Root layout with navigation
│ ├── page.tsx # Home page
│ ├── api/
│ │ ├── events/route.ts # Events API endpoint
│ │ └── funnel/route.ts # Funnel API endpoint
│ ├── events/page.tsx # Events viewer page
│ └── funnel/page.tsx # Funnel analysis page
├── components/ # Reusable React components
├── data/
│ └── events.json # Sample event data (~56k events)
├── lib/
│ ├── db.ts # Data loading utilities
│ └── types.ts # TypeScript type definitions
└── scripts/
└── generateEvents.ts # Sample data generator
Fetch paginated events data
Query Parameters:
page(number, default: 1)limit(number, default: 50, max: 200)session_id(string, optional) - Filter by session ID
Response:
{
"data": [...],
"pagination": {
"page": 1,
"limit": 50,
"total": 56773,
"totalPages": 1136
}
}Get funnel analysis data
Response:
[
{
"step_name": "page view",
"sessions": 15000,
"pct_from_previous": 100,
"pct_from_start": 100
},
...
]Events are categorized as:
page_view- User visited a pageadd_to_cart- User added item to cartbegin_checkout- User started checkoutpurchase- User completed purchase
# Run TypeScript compiler
npx tsc --noEmit
# Run ESLint
npm run lint
# Build for production
npm run build
# Start production server
npm startMIT
- Heroku CLI installed
- GitHub account connected to Heroku
-
Create a Heroku app
heroku create your-app-name
-
Deploy
git push heroku main
-
Set up automatic data refresh (optional)
- Go to your Heroku app dashboard
- Add the Heroku Scheduler add-on (free tier available)
- Create a new scheduled job:
- Command:
curl -X POST https://your-app-name.herokuapp.com/api/admin/regenerate-data -H "Authorization: Bearer YOUR_TOKEN" - Frequency: Daily (or as needed)
- Command:
- Add environment variable
SCHEDULER_TOKENto your app config
-
View your app
heroku open
SCHEDULER_TOKEN=your-secret-token
- On deployment (Procfile
releasephase) - Daily via Heroku Scheduler (if configured)
- Manually via
/api/admin/regenerate-dataendpoint