A grounding rod needs to comply with the electrical coding regulation, which is 8 feet long.
For electric fences, the grounding rod should be no less than 4 feet long and buried in the ground accordingly.
You will want to drive the grounding rod all the way into the ground, which can be difficult at times if the soil is too dry and compacted.
Dampening the ground if this happens is a great way to make it a little easier to push the rod into the soil as needed.