Affiliate tracking can be quite complex, so here's an overview of the features. Firstly an overview of the process to decide which affiliate campaign will be used
Grab campaign from user table - could be null
Decode cookie if possible, and assign matching campaign to this session