How do I get location (country) before page/app loads?

I want to optimize my marketplace for SEO, so I want to create individual content on the landing page based on where the user is from. So ideally I would want to check where the user is from and redirect to different pages, which show different vendors per location.

So the redirection could be something like this:
www.pigments.io/thailand/landing
www.pigments.io/philippines/landing

etc. …any idea if this is somehow possible? Also, just in general if anyone has experience with SEO, is this the right approach to tackle the issue of multi-location based SEO for a marketplace?