ごとに is an combination of the noun
ごと, and the particle
に. Together, they are used adverbially to express that something happens 'every (A)', or 'at intervals of (A)'.
ごとに may be used after any verb (usually in non-past form), or noun.
私(わたし)は彼(かれ)に会(あ)うごとに、「何(なに)を食(た)べたい?」と聞(き)かれます。
Everytime I see him, he asks me 'What do you want to eat?'
私(わたし)は3時間(じかん)ごとにお菓子(かし)を食(た)べます。
I eat snacks every 3 hours.
Although
ごとに may be used after verbs, the most common use is with nouns, or phrases that finish with nouns.
ごと is the 訓読(くんよ)み (Japanese reading) of the kanji 毎(まい), which means 'every'. This fact will be important when trying to remember the difference between
ごとに, and
おきに, a similar grammar point which also means 'every', but focuses more on 'intervals'. Due to
おきに focusing on the space between 'each', there are sentences where
おきに and
ごとに will have different meanings.
私(わたし)は一週間(いっしゅうかん)ごとに実家(いえ)に帰(かえ)ります。
I go to my parents' home every week. (Every single one)
私(わたし)は一週間(いっしゅうかん)おきに実家(いえ)に帰(かえ)り ます。
I go to my parents' home every other week. (Every single interval of one)
Here, we can see that
ごとに will mean 'every week', but
おきに will mean 'every second week'. due to there being a 'one week interval' when
おきに is used. To make things easier, these two expressions can be remembered in the following way.
(A)
ごとに = Every (A)
(A)
おきに = Every spaced repetition of (A)
Many native speakers make mistakes with the difference between おきに and ごとに, so there are quite a large number of people (especially in the younger generation) that will consider them completely interchangeable.