Follows a verb of cognition (e.g., 見る, 思う, 聞く) to mean 'every time one does that action'. Often used in the pattern 〜につけて.
彼の顔を見るにつけて、昔のことを思い出す。
Every time I see his face, I remember the old days.
この曲を聞くにつけて、学生時代を思い
Used in the paired pattern 〜につけて〜につけて, often with contrasting adjectives or verbs, to mean 'whether A or B, in either case'. Common with words like 良い/悪い, 嬉しい/悲しい.
Whenever I hear this song, I recall my school days.
Whether good or bad, we have no choice but to accept the result.
嬉しいにつけ悲しいにつけ、人生は続いていく。
In joy or in sorrow, life goes on.
〜ごとに means 'each time' or 'every', often with a sense of repetition or intervals. 〜につけて is more about a trigger for a memory or feeling.
Derived from the verb 付ける (to attach) in its continuative form 付け, combined with the particle に. The expression grammaticalized into a conjunction-like phrase meaning 'on the occasion of' or 'whenever'.