Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- to load the chat group based on the visitor's county.
- Here's a code, that should be in the website's source code:
- <?php $ipaddress = $_SERVER['REMOTE_ADDR']; $query_url = "http://api.wipmania.com/".$ipaddress; $country_code = file_get_contents($query_url);
- if ($country_code != ‘US’ || $country_code != ‘CA')
- {
- include 'js_eng.js';
- }
- else
- {
- include 'js_else.js';
- } ?>
- 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.
- In js_eng.js file you need place the following Javascript code for US and Canada group:
- <!-- Start of LiveChat (www.livechatinc.com) code -->
- <script type="text/javascript">
- window.__lc = window.__lc || {};
- window.__lc.license = 8461547;
- window.__lc.group = 1;
- (function() {
- var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
- lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
- })();
- </script>
- <!-- End of LiveChat code -->
- In js_else.js file please place code for Europe-Sales group
- <!-- Start of LiveChat (www.livechatinc.com) code -->
- <script type="text/javascript">
- window.__lc = window.__lc || {};
- window.__lc.license = 8461547;
- window.__lc.group = 2;
- (function() {
- var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
- lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
- })();
- </script>
- <!-- End of LiveChat code -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement