Show bot based on country

Hi, I saw your article to NOT SHOW the bot when the user comes from specific countries

Can you please write to code, but in the other way, TO SHOW the bot when user comes from a specific country?
thanks in advance
PA. Congratulations, lovely software

Hi Ocatvio,

For that you just need to change the condition. Here you go:

<script src=""></script>
List of countries where you want the bot to be loaded.
Modify this list as per your need.
var list = {
  "IN": "India",
  "GB": "United Kingdom"
$.get("", function(response) {
   /* Check if is in list */
   if(JSON.stringify(list).indexOf( >= 0) {
       /* The country of visitor is not in blocked_list, so you can load the chatbot snippet code */
       (function(w, d) { w.CollectId = "5c75363c7744836a0231a583"; var h = d.head || d.getElementsByTagName("head")[0]; var s = d.createElement("script"); s.setAttribute("type", "text/javascript"); s.setAttribute("src", ""); h.appendChild(s); })(window, document);
}, "jsonp")

Try this. It should work

Hi Aslam,
Yes, I inserted the code in wordpress.
Changed the w.CollectId and inserted the country “ES”, I believe it’s for spain, also included india.
It worked perfect !! :heart_eyes:

1 Like

Dear Aslam,
I’ve news with the country allowed. This is part of the code I’m using now

List of countries where you want the bot to be loaded.
Modify this list as per your need.
var list = {
“IN”: “India”,
“ES”: “Spain”

And it works for Spain perfect !!
Happen that yesterday was talking with a person from Chile, and she was able to see the chatbot.
I only allowed “ES” = Spain ( )
How can is ir possible?
Thanks in advance

Hi there,

The method I shared is not error-proof. The following scenarios could have happened.

  • She was using a VPN service or an IP changing service on her browser
  • Her browser may have plugins that blocked the site ipinfo
  • The site ipinfo may not have send and received the request in time

The code we shared is just a sample code to guide you in the right direction. It can be further optimized and there are alternate methods to do the same as well.

This is something you will have to discuss with the developers in your team and resolve it. We can only help you with the chatbot that you made on We cannot be of much help when it comes to over-the-top tweaks like these.

Thanks for understanding,
Aslam from

Yes, it’s ok for me

1 Like