It is often asked in official immigration forms (US) about the countries visited in the past. Do flight connections count in this case, or do they mean exiting the airport/gate area?
It is normally considered a visit if you are processed by Customs and Immigration, which you don't usually do on a connecting flight.
Better safe than sorry. If you claim to have visited a country but never left the airport, what will happen to you? Nothing. They may say "tell me about your visit to X" and you will say "actually I never left the airport, it was a connection" and that's that. No consequences.
But if you leave it off, and they say "well how did you get from A to B?" and you say "I transited through C" and then they say "why didn't you list C on here?" then suddenly you're a person whose answers on the form might not be complete.
I recently had to list ten countries to answer that question. I listed them all. Just do it.