[noun] + ごとに [verb (dictionary form)] + ごとに
ごとに means "every" or "each". After a time word or a number with a counter it gives a regular interval; after an ordinary noun it says something applies to each one separately. It follows the noun directly.
With minutes, hours or metres the two mean the same: ごふん5分おきに is every five minutes. With days, years or counted things, おきに counts the gap between, so it skips one more than ごとに.
These go beyond a fixed interval or each item in turn.
After a verb in the dictionary form, ごとに means "every time". The second half usually describes something that builds up.
ごとに can be written ごとに毎に, but the hiragana spelling is the usual one.