Sales are typically tracked with cookies. Each affiliate program is set up differently with a different cookie which determines after how long a referrer is still valid.
We typically see a 30 day cookie life but they do vary according to the Merchant's terms.
Amazon affiliate cookies for example, last 24 hours. If someone follows your link and makes a purchase within 24 hours, you are credited with the sale. If they follow your link and add an item to their cart – and then make that purchase within 89 days – you are credited with the sale.
In this case, since your cookie lasts for 24 hours (or 89 days on items placed in their cart), you are credited with the sale even if they click on another affiliate’s Amazon link during that time frame. So with Amazon, it’s the first click until the cookie expires.