I decided to not use an optical sensor after about a month of using one. Crud would build up on it and it would go all wanky unless I cleaned it every few days. This was even with the skimmer cup not even close to 1/4 of the way full. Just the stuff from the foam going past/over it on the way into the cup was enough to get it dirty.
I decided to switch to a float with a long stem and just took a soldering iron and made one of the vent holes slightly larger for it to fit. I now have it wired to my B/O box and setup to turn the skimmer off/alert me when the cup is full. Works great and I do clean the stem and float off when I dump the cup. But even then, it doesn't really have as much on it as the optical sensor did.
Edit: When I ran one, I just took a Dremel and ground the lid down a little so the cable would not push the lid up. I then routed the wire to the top of the lid and fastened with a small zip tie through some vent holes. This created a drip loop, so any liquid did not run down on the outside of the cup.