This is sort of a cloaking question, but sort of general as well. We're going to be cloaking, but also want to serve cookies as part of a tracking effort.
Both the tracking referrer "grab" and the cloaking must be executed from the same page, and users will be served a cookie in the process. That means engines will get the cookie too...so the important question is: Do engines penalize at all for serving cookies, or rather, does this affect, in any way, the optimization performance of a page?
The short answer is there will be no effect, the SE spiders are largely oblivious to cookies. A little consideration might be to make the cookie serving separate code form the cloaking code. That way you can add or subtract easily if you wish to do one but not the other on particular pages.