Affiliate Tracking

Complete affiliate tracking system for Convex apps with attribution, commissions, payouts, and analytics in an isolated component.

Installation

npm install @ezyyeah/affiliate-tracking

About Affiliate Tracking

A 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.

Benefits

Use cases

how to add affiliate tracking to Convex app

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.

Convex affiliate commission tracking

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.

affiliate link click tracking Convex

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.

affiliate analytics dashboard Convex

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.

Frequently asked questions

How does the affiliate attribution model work?

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.

Can I customize commission rates for different affiliates?

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.

How does the component handle authentication and authorization?

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.

What analytics data does the component provide?

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.

How do I handle duplicate conversions and clicks?

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.

Links