Most network affiliate programs understand that a sale may not occur the first time someone goes from an affiliate site to the merchant site. If this occurs, however, there are ways for an affiliate to still gain commission if a consumer buys from the merchant at a later date.
There are several different methods for tracking referrals but using a cookie is among the most common. The cookie holds information about a site and is good for a set amount of days (usually around 30). If a visitor goes to a merchant site through an affiliate site, leaves before buying, and then returns again a few days later to make the purchase, the network affiliate program still credits the affiliate account with the commission for that sale (as long as the customer didn't visit any other affiliate sites in between which would overwrite thecookie).