Modify tracking and referral functions

Fixes: https://github.com/affiliatewp/AffiliateWP/issues/358