detect visitor GEO Location using API or codes Only, no apps please

mo_badawy
New Member
4 0 0

hello

Good day

 

I need any code which i can use for detecting my visitor location, country code or country name using Shopify API or any other tool, and only coded tools

I don't need apps, or any outside plugins, because after detecting the country i will do other codes depends on country type

 

Please help me ASAP

Thanks

0 Likes
Jason
Shopify Expert
10360 158 2003

Shopify doesn't offer a geolocation service so you'll need to use an external system or rely on the browsers HTML5 Geolocation feature. Do note that to use the browsers feature will show a browser message asking for permission.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
mo_badawy
New Member
4 0 0

thank you for your response

actually, i contacted the support, and they told me that API can detect it ??
I'm wondering if there is code can do this from the shopify api or apps.js file !!

0 Likes
MichaelGeo
Pathfinder
191 3 14

Hi there!

 

Here is Geo Targetly solution worth checking out.

 

It provides Geo Location API that can easily access your visitors' location, like country, and country, using simple Javascript variables and geolocation Html tags. For example,

 

geotargetly_country_name(); //gets visitor country name
geotargetly_country_code(); //gets visitor country code
geotargetly_region_name(); //gets visitor Region/State or state name
geotargetly_region_code(); //gets visitor Region/State or state code
geotargetly_city_name(); // gets visitor city name
geotargetly_lat(); // gets visitor latitude
geotargetly_lng(); // gets visitor longitude 
geotargetly_ip(); // gets visitor IP address

geotargetly_loaded(); // gets called when data is available


//----------------Example-------------

function geotargetly_loaded(){
  var country_name = geotargetly_country_name();
  if (country_name == "United States"){
      //do something
  }
}

 

You don't even to code yourself, but simply drag in Javascript code they provided. Hope it helps!

 

MBelb
New Member
1 0 0

Hi there,

thank you for the code you provided. I am kind of a beginner on this and would really appreciate if your tell me where exactly I should place the code?
Also, is it possible to add a map with a small cursor that is shown to customers, so that they approve the location that is determined automatically and move it to the correct exact location if it was not very exact?

Thank you in advance.

0 Likes