As described in the main documentation, Shift4Shop's built-in Affiliate Program will track users and their orders when they arrive to your store via an affiliate member's link. Merchants using the Affiliate Program can specify how long the tracking cookie will last once it is set on a visitor's browser.
When setting up the Affiliate Program module, you will see a drop-down menu labeled "Affiliate Cookie Length (days), which will let you specify the lifetime of the tracking cookie.
You may set it between 30-days and 360-days depending on your specific needs. Once set, the cookie will expire after the number of days you specify. If a visitor comes to your store from an affiliate link, but does not purchase anything, the affiliate can still get credit for the order if the user comes back within the set time period. After the cookie expires, orders from that customer will not count towards the Affiliate's orders unless the visitor is referred to your store again by the affiliate.