Most likely if anyone was actually watching you they knew exactly what you did. You would have been better off, not to mention honest, if you had just passed it along. Lots of people do.
As for anonymous giving in a collection plate, there are lots of ways to do that. Any church I've been to...