You'll find many different opinions on this....
....but, if you're looking for clean and distorted gating, I'd recommend putting it right before whatever you're using for gain.....otherwise you'll have problems setting the threshold for the gate to close.
But putting it before the gain source (preamp or pedal) you'll ensure that it's always recieving a clean signal, thus the threshold will always be matched correctly.