The G before the vowels A, O and U, sounds like if it was before a consonant, Ex: garganta, grillo, argumento, gordo, pregunta, agua. It's like the sound of "good".
If the G is before the vowels E and I, it sounds like the J. Ex: Argentina, gelatina, girasol, girar, German. It's like the sound of H in english, ex: Help.
And the third roule is: if G is before the U... and that "U" is before E or I, the sound is the same that the first roule. Just that the U doesn't sound. Ex: guerra, guiño, guiso, seguir, erguido, seguera.