Two common solutions. One is the flap that DaddyJoe mentioned. It's been done differently, but the idea is to use something to keep mud and dirt from being flung off the tire onto the shock strut. Use your best judgement in figuring out a way to do this. Some have used old inner tubes, some have used stiffer bits of plastic.
The other solution (which I have) is a nylon shock cover. It velcroes over the shock and covers the whole thing. It's a pain to remove to adjust preload or rebound settings, but it's been on there for three years. It has a hole in it where the spring sometimes hits the swingarm. The shock stays clean, though, so that's the point.