I have a store owner that would like to be able to display a phone number based on the customer's location, it would only be 3 offerings, the US, Ireland, and the rest of the world. Is this doable?
Geolocation to serve up info
Collapse
X
-
Geolocation to serve up info
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: X | Facebook | Pinterest
Tags: None
-
I'd recommend doing this by way of adding Cloudflare in front of the site; preferably the $20/mo Pro plan given the huge list of other benefits, but the free plan should work too. Better than paying for a geolocation service. Then you can look at the CF-IPCountry header to determine if the country is US, IE or neither.
https://support.cloudflare.com/hc/en...IP-Geolocation
-
Interesting - the next step would be how to incorporate that information into a snippet that displays the correct phone number.Originally posted by ILoveHostasaurus View PostI'd recommend doing this by way of adding Cloudflare in front of the site; preferably the $20/mo Pro plan given the huge list of other benefits, but the free plan should work too. Better than paying for a geolocation service. Then you can look at the CF-IPCountry header to determine if the country is US, IE or neither.
https://support.cloudflare.com/hc/en...IP-GeolocationLeslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: X | Facebook | Pinterest
Comment
-
You'd want to list out the variables via diagtool or similar to confirm the name, but that header value would show up as a s.HTTP_ variable that template code can look at, which you could then base conditions on.
Comment
-
Cloudflare looks interesting. Could it also be used to blocking certain traffic?
For example, could it be used to block traffic from Lancashire UK which, I believe, is a county/region, as opposed to a city? Or any other hotspot that is placing fraudulent orders?
Comment
-
They only get as specific as country. I checked and they group all of United Kingdom into one selection option, nothing more specific. At the country level though, you can do a transparent challenge in Javascript, where legit shoppers just see a browser challenge for a few seconds and can then continue to shop for 30 minutes by default. That stops most bots / automated scripts that perform fraudulent orders. You can increase the level to a captcha challenge if there's a country you don't care too much about but still want to have the option of possible site access.
Comment
Comment