Has anyone implemented a way to prevent users from initiating a chat if a visitor is coming from a country where customer has no presence using geo-location within live agent. Are their any best practices around how to implement this type of functionality? Thanks in advance.

1 Answer 1


As a best practice: don't do it (at least, automatically). Just because they appear to be located in a place you don't service does not mean they are in that place, or that they live there permanently. For example, what if they use a VPN, or TOR, or some aggregate connection that masks their real presence by a significant margin? What if they're on vacation, business travel, or planning to move to somewhere where you could gain them as a customer?

If you must do it, you should ask them to self-identify where their primary residence is, perhaps by way of a drop-down, so that they can access the service if they really should have the ability to chat with a person. As for the technical reason "how", you'd basically just check their location by some means, then make a decision if you'd like to display a message telling them your services are not available, or rendering the script tags that would be used to ultimately render the chat button (for example, see this question/answer).

  • 1
    Thanks, I agree that relying solely on Geo-location to determine country code is not reliable and collecting country code in pre-chat would be a essential. My question was more specific to Salesforce live Agent product to see if others have implemented similar functionality and if there are sample code or best practices docs that I could review. Thanks again for the response.
    – vin
    Jun 6, 2016 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.