Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1.  
  2.  
  3. to load the chat group based on the visitor's county.
  4. Here's a code, that should be in the website's source code:
  5.  
  6.  
  7. <?php $ipaddress = $_SERVER['REMOTE_ADDR']; $query_url = "http://api.wipmania.com/".$ipaddress; $country_code = file_get_contents($query_url);
  8.  
  9.  
  10. if ($country_code != ‘US’ || $country_code != ‘CA')
  11. {
  12. include 'js_eng.js';
  13. }
  14. else
  15. {
  16. include 'js_else.js';
  17. } ?>
  18.  
  19.  
  20. It's checking if the visitor is from USA or Canada, if yes it will load US and Canada group, if visitor is not from predefined countries it will load Europe-Sales group.
  21.  
  22.  
  23. In js_eng.js file you need place the following Javascript code for US and Canada group:
  24.  
  25. <!-- Start of LiveChat (www.livechatinc.com) code -->
  26. <script type="text/javascript">
  27. window.__lc = window.__lc || {};
  28. window.__lc.license = 8461547;
  29. window.__lc.group = 1;
  30. (function() {
  31. var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
  32. lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
  33. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
  34. })();
  35. </script>
  36. <!-- End of LiveChat code -->
  37.  
  38. In js_else.js file please place code for Europe-Sales group
  39.  
  40.  
  41. <!-- Start of LiveChat (www.livechatinc.com) code -->
  42. <script type="text/javascript">
  43. window.__lc = window.__lc || {};
  44. window.__lc.license = 8461547;
  45. window.__lc.group = 2;
  46. (function() {
  47. var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
  48. lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
  49. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
  50. })();
  51. </script>
  52. <!-- End of LiveChat code -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement