Advertisement
livechatinc

Load group based on IP Address

Dec 18th, 2015
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <!-- Start of LiveChat (www.livechatinc.com) code -->
  2. <script type="text/javascript">
  3. window.__lc = window.__lc || {};
  4. window.__lc.license = 3358262;
  5.  
  6. <?php
  7.  
  8. $ipaddress = $_SERVER['REMOTE_ADDR'];
  9.  
  10. //based on ip address
  11. //some condition here
  12. if($ipaddress)
  13. {
  14. ?>
  15. window.__lc.group = 1;
  16. <?php
  17. }
  18. else
  19. {
  20. ?>
  21. window.__lc.group = 2;
  22. <?php
  23. }
  24.  
  25. ?>
  26.    
  27. (function() {
  28.   var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
  29.   lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
  30.   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
  31. })();
  32. </script>
  33. <!-- End of LiveChat code -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement