I am selling both Amazon in the US and AUS. I am creating landing pages however I want the correct pages to be displayed when a user navigates to the site from an advertisement.
So we can essentially have a generic link but require this to show a either the US landing page ot AUS landing page.
Or alternatively change the “links” based on location
Since you only need to know the location at the country level, I’d suggest to use a third party to get the country by IP.
(The solutions that Yisrael suggested require user consent).
@andrewcallewaert there’re many solutions out there. I don’t know which is better and haven’t read reviews. I just picked up one of them and worked with it.
See for example: https://ipapi.co/json
For actually getting the IP on your Amazon resale page, you can create them as Router pages, rather than Site pages, to access the IP for each user visiting the page. That will ensure you don’t have a flashing effect on the page, because the Router will do provide the custom AUS/US link to the page before it loads.
For actually resolving the IP to a location, I remember checking out (but never using) IPStack, which used to be called GeoIP or something like that. They provide the following info in their API.