I realized this is missing in the developer guide. I've added a task to fix that.
It is tied together by IRecommendationContext. The implementation of that service will be asked for the current recommendation ID when the next tracking request is sent. In quicksilver it is handled by a cookie as you have seen, but there may be other ways to do it.
I still do not understand. The cookie is set but never is read. Is there some hidden cookie reading in that IRecommendationContext?
It is read, in the EPiServer.Reference.Commerce.Site.Features.Recommendations.Services.RecommendationContext class. Maybe you found the NullRecommendationContext that is shipped with the framework just as a default.
It is designed this way to allow you to use whatever approach you want to track the clicks in your implementation. We considered it too complicated and invasive (to the site implementation) to add a one size fits all framework solution.
Thanks! Now it makes more sense. I couldn't find the cookie key anywhere in the code but it is hidden in the EPiServer.Business.Commerce.CookieHelper.
P.S. You definitely should add docs about click tracking :)
I found that click tracking sets cookie here:
https://github.com/episerver/Quicksilver/blob/eaa1427edc34c778340589cb1d6f0fd53b60e605/Sources/EPiServer.Reference.Commerce.Site/Scripts/js/Recommendations.js#L8
But I am not able to find where this cookie is handled. How does it work?