Cookies have an expiration date, they are deleted after some time from the user’s browser.
Normally, the expiration time is between 30 and 90 days. Why so long? It has something to do with affiliate marketing, especially with affiliates that are paid for conversions or sales.
It is highly unlikely that visitors will buy as soon as clicking the affiliate link. They need time to consider and build trust. The conversion or sale that may happen in two weeks after the click comes from the affiliate’s link still.
Cookies store information about the user and if it is the one who came from an affiliate, they will be marked so till cookies expire. An affiliate will be paid for that conversion or sale even though it did not happen right after the click.
However, if cookies expire before a visitor makes a purchase, an affiliate will not be rewarded.