Revenue attribution analytics for course creators. Track which marketing channels actually drive sales.
A complete MVP for tracking and attributing course sales to marketing sources (YouTube, Instagram, Google, etc.) for creators using Kajabi, Teachable, or Stripe.
- Visitor Tracking: Lightweight JS snippet (<5kb) tracks visitors across sessions
- Purchase Attribution: Automatically matches purchases to visitor sources (85%+ match rate)
- Kajabi Integration: OAuth flow, webhooks, and historical sync
- Analytics Dashboard: Revenue by source with conversion rates and trends
- Authentication: Secure signup/login with email verification
- Real-time Updates: Live purchase feed on dashboard
- Backend: Node.js + TypeScript + Express + PostgreSQL + Redis
- Frontend: React + TypeScript + Vite + Tailwind CSS + React Query
- Tracking: Vanilla TypeScript with FingerprintJS
- Integrations: Kajabi OAuth, Stripe (billing), Email (SendGrid)
CourseSignal/
├── backend/ # Express API server
│ ├── src/
│ │ ├── db/ # Database connection & migrations
│ │ ├── routes/ # API endpoints
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Auth & rate limiting
│ │ └── utils/ # Helpers (JWT, encryption, validation)
│ └── package.json
├── frontend/ # React app
│ ├── src/
│ │ ├── pages/ # Route components
│ │ ├── components/ # Reusable UI
│ │ ├── stores/ # Zustand state management
│ │ └── lib/ # API client
│ └── package.json
├── tracking-script/ # Visitor tracking library
│ ├── src/
│ │ └── index.ts # Main tracking logic
│ └── package.json
└── package.json # Workspace root
- Node.js 18+
- PostgreSQL 14+
- Redis (optional for MVP)
- Install dependencies
npm install
- Set up environment variables
Backend .env
:
cp backend/.env.example backend/.env
# Edit backend/.env with your values
Frontend .env
:
echo "VITE_API_URL=http://localhost:3000/api" > frontend/.env
- Create database
createdb coursesignal
- Run migrations
npm run migrate --workspace=backend
- Build tracking script
npm run build --workspace=tracking-script
Run all services:
# Terminal 1: Backend
npm run dev:backend
# Terminal 2: Frontend
npm run dev:frontend
Visit:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
- Sign up with email & password
- Choose platform (Kajabi/Teachable/Stripe)
- Connect via OAuth or API key
- System syncs last 30 days of purchases
- Copy tracking script to course site
- View dashboard with historical data
- See revenue by source (YouTube: $8K, Instagram: $400)
- Check conversion rates per channel
- Export reports to CSV
- Make data-driven marketing decisions
POST /api/auth/signup
- Create accountPOST /api/auth/login
- Sign inPOST /api/auth/verify-email
- Verify emailGET /api/auth/me
- Get current user
GET /api/analytics/summary?range=30d
- Revenue summaryGET /api/analytics/sources?range=30d
- Revenue by sourceGET /api/analytics/recent-purchases
- Last 20 purchasesGET /api/analytics/export?range=30d
- Download CSV
GET /api/kajabi/connect
- Initiate OAuthPOST /api/kajabi/sync
- Trigger syncGET /api/kajabi/sync-status
- Check progress
POST /api/tracking/event
- Record visitor sessionGET /api/script/generate
- Get tracking script
Key Tables:
users
- User accounts & subscription statusvisitors
- Unique visitors with first-touch attributionsessions
- Individual visitor sessions with UTM datapurchases
- Course purchases with attributionplatform_integrations
- OAuth tokens & webhook IDssync_jobs
- Background sync status
See backend/src/db/schema.sql
for full schema.
- First-Touch: Credit goes to visitor's initial source
- Last-Touch: Credit goes to most recent source before purchase
- Matching Priority:
- Email match (most reliable)
- Device fingerprint + timing (within 24h)
- Marked as "unmatched" if no match
Target: >85% match rate
- Set environment variables
- Connect PostgreSQL database
- Deploy from GitHub
- Run migrations
- Set
VITE_API_URL
- Deploy from GitHub
- Configure custom domain
- Upload
tracking-script/dist/track.js
to CDN - Update script URL in backend
See IMPLEMENTATION_GUIDE.md
for:
- Frontend completion steps
- Stripe billing integration
- Teachable/Stripe platform integrations
- Production deployment checklist
MIT
For beta testing or questions:
- Create an issue on GitHub
- Email: support@coursesignal.com