Best Way to Implement Affiliate Link Tracking in CodeIgniter 4? |
I’m building a lightweight affiliate system using CodeIgniter 4, where users can generate and share unique referral links—similar to how GrabCash manages its Profit Links system.
I want to track the following data:
Should I handle it via middleware or use a dedicated controller for tracking logic? Also, are there any best practices to prevent bot/fake clicks and ensure more accurate tracking? Thanks in advance for your suggestions!
1) Clicks on each referral link
Use CodeIgniter Events for tracking referrals, you may also need to use CodeIgniter's _remap to check the referral links. 2) Source of traffic (e.g., WhatsApp, Instagram, etc.) You can check what kind of app like WhatsApp is accessing your website in PHP by examining the User-Agent header of the HTTP request. 3) Basic analytics like IP address, timestamp, and referral ID This would need to be saved in the database. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |