Complete affiliate tracking system for Convex apps with attribution, commissions, payouts, and analytics in an isolated component.
npm install @ezyyeah/affiliate-trackingA complete affiliate tracking system for Convex applications that handles programs, affiliate enrollment, referral link creation, click tracking, conversion attribution, and commission payouts. It provides isolated database tables and comprehensive analytics while letting your app handle authentication and billing. The component offers flexible attribution models with configurable deduplication and commission structures.
The @ezyyeah/affiliate-tracking component provides complete affiliate functionality as an isolated Convex component. Mount it in your app config, create programs with commission rates, enroll affiliates with referral links, and track clicks through HTTP actions that redirect visitors while recording attribution data.
This component automatically calculates commissions when conversions are recorded, supporting both percentage and fixed-rate models. Conversions move through pending, approved, rejected, and paid states with full audit trails and can be batch processed into payouts for approved commissions.
Track affiliate clicks from Convex HTTP actions using the trackClick mutation, which records visitor data and returns the destination URL for redirects. The component handles deduplication based on configurable rules and attribution windows defined at the program level.
Access affiliate performance data through getSummary for aggregate numbers and getDailyBreakdown for time-series analytics. The component maintains daily sharded counters for clicks and conversions across program, affiliate, campaign, and link dimensions.
The @ezyyeah/affiliate-tracking component uses configurable attribution windows and deduplication rules per program. You can set how long clicks remain eligible for conversion credit, deduplicate clicks by visitor or link, and limit conversions by customer or visitor within rolling time windows.
Yes, the component supports both program-level default commissions and campaign-specific overrides. Programs define default commission types (percentage or fixed) and values, while campaigns can override these settings for specific affiliate promotions or products.
The @ezyyeah/affiliate-tracking component intentionally does not handle auth - your host app manages authentication and authorization. You check permissions in your Convex functions and pass actorId strings to component functions for audit trails.
The component tracks clicks, conversions, commissions, and revenue through daily sharded counters. You can access aggregate summaries and daily breakdowns scoped by program, affiliate, campaign, or link using the getSummary and getDailyBreakdown functions.
The @ezyyeah/affiliate-tracking component provides multiple deduplication strategies including visitor-based, link-based, and custom deduplication keys. Conversions use idempotency keys to prevent double-counting, and you can configure rolling windows for both click and conversion deduplication.