affiliated
Affiliate Tracking Framework for Drupal 10.3+
Affiliated provides the core infrastructure for tracking affiliate referrals and conversions in Drupal. It works out of the box for basic affiliate tracking, but the real power comes from extending it with your own business logic.
Use the included submodules for simple implementations, or build custom conversion types, reporting, and commission rules tailored to your specific needs. The aim of this project is to provide the hooks, events, and entity structure to build your own affiliate tracking system based on your specific needs.
This was originally based off the work done in affiliate_ng (Drupal 7), rebuilt for modern Drupal with improved architecture and extensibility.
What's Included
- Click Tracking – Automatically detects affiliate links (
?affiliate=CODE), manages cookies, and logs clicks - Conversion Entity System – Bundled entity type for tracking any conversion event you define
- Campaign Management – Affiliates can organize links into campaigns to track which efforts perform best
- Affiliate Dashboard – Each affiliate gets a dashboard at
/user/UID/affiliatefor link generation and statistics - Ready-to-Use Submodules – Track Commerce orders, user registrations, and webform submissions
How It Works
- Click – Visitor arrives via an affiliate link (
yoursite.com?affiliate=john123) - Cookie – Affiliate ID is stored in the visitor's browser
- Action – Visitor completes a trackable action (purchase, registration, form submission)
- Conversion – If an affiliate cookie is found on the device, a conversion entity is created and attributed to the affiliate account
Included Submodules
- affiliate_commerce – Track Drupal Commerce order conversions
- affiliate_registrations – Track new user registration conversions
- affiliate_webform – Track webform submission conversions
For production sites, you'll likely want to extend this basic functionality or create custom conversion types that include your commission rules, validation logic, and business-specific requirements.
Extending the module
The framework is designed to be extended. Most implementations will add:
- Custom conversion types with specific commission calculations and validation
- Detailed reporting Views for affiliates and administrators
- Payout tracking and management workflows
- Custom notification systems and affiliate communications
- Integration with your specific business processes
There is extensive documentation in the README file. Refer to this for examples of implementing custom conversion types, using hooks, and responding to events. I will keep this file updated as new features and API improvements are added.
Quick Start
- Install the module like normal:
composer require drupal/affiliatedanddrush en affiliated - Configure settings at
/admin/config/affiliate/settings - Grant users that you want to be affiliates the "act as an affiliate" permission at a minimum, if you want them to view reporting you will also want to grat view access to the clicks, conversions, campaigns, etc.
- Enable the submodules you need (or create custom conversion types at
/admin/structure/affiliate/conversion/types) - Affiliates can access their dashboard at
/user/UID/affiliate
Development Status
Alpha stage: The module is functional and personally being used in production, but expect API changes before a stable 1.0.
Support & Contributing
Report bugs, request features, or submit patches in the issue queue. If you find this useful please chime in and let me know in the issue queue and on the #affiliated slack channel.