Those link clicks are tracked, along with any resulting sales. The tracking ties the activity back to marketers so agreed-upon commissions can be paid.
Note that customers may not need to buy immediately for marketers to get credit for the transaction. Sellers will define the time that can pass between link click and purchase. The Amazon (AMZN +0.28%) affiliate program requires the customer to put an item in the cart within 24 hours, for example. Say a customer visits Amazon from a marketer's affiliate link, leaves, and then returns three days later to buy something. In that case, the marketer would not earn a commission on the sale.
Affiliate sales commissions generally range from 2% to 25%, depending on the product and the gross margin it generates for the seller. Amazon pays affiliates a 20% commission on the sale of Amazon Games, but only 2% on grocery, personal, and healthcare items.