Block a country from accessing your website

Highlighted
New Member
4 0 0

Because of risks of fraud, I wish to block a particular country users from accessing a Shopify website. Is it possible to do this? If not possible, what are the options available to me?

As I understand one option is to denying access to users in that country from being able to set up Shipping Addresses. 

One more option is to use Fraud Filter App. This sounds good. How does Fraud Filter App protect? Does it not make the access to website somewhat slow? Is there any link where I can find more information about Fraud Filter App?

Thanks a lot

0 Likes
Shopify Partner
371 0 51

There are javascript libraries out there that will detect a users IP and redirect them to an external site a good starting point is probably

http://docs.shopify.com/manual/configuration/store-customization/page-specific/store-wide/get-a-visi...

Want an app but can't find what you need? Let us know we custom build apps for Free
0 Likes
New Member
4 0 0

Thank you.

I have identified the addition of following code to the themes governing my website:

<script>
jQuery.ajax( { 

  url: '//freegeoip.net/json/', 
  type: 'POST', 
  dataType: 'jsonp',
  success: function(location) {
    // If the visitor is browsing from the country XYcont.
    if (location.country_code === 'XY') {
      // Redirect him to the say google.
      window.location.href = 'http://www.google.com';;
    }
  }
} );
<script>

I am actually new to Shopify, therefore would request your help here.

I guess this has to be added to the theme.liquid file governing my website. This code has to be wrapped in any more tags before adding it to the theme.liquid file?? Any particular location where the code has to be inserted in the theme.liquid file? Are the changes to the theme.liquid file and corresponding reflection on the website (diverting to google here) instant? Doesn't XY have to be wrapped in double quotes?

Secondly I wish to know whether any plug like Fancybox is required to make it work or it can work even without that?

 

0 Likes
Excursionist
22 0 4

Hey folks,

Sorry to hear you've experience fraud from a particular country. Unfortunately, you might be blocking some good users.

I am the Shopify account manager at Sift Science, home of the most advanced fraud app. Sift takes thousands of signals into account, including IP address, and has been shown to block fraud while also not turning away good users. Additionally, Sift works well in conjunction with Shopify fraud filter and other apps.

Sift is completely free if you have under 10,000 transactions per month.

Feel free to sign up here or reach out to me via email with questions.

Happy fraud fighting!

Erica

support@siftscience.com

0 Likes
New Member
9 0 0

Due to the new laws coming into effect tomorrow for EU VAT I now need to block all EU customers or re-direct them to another store that can take care of all the VAT issues.  I'm interested to implement the script above and am wondering if you had any success?

0 Likes
New Member
4 0 0

I added following code to the bottom of  Launchpad theme's theme.liquid file 
  
<script>
jQuery.ajax( { url: '//freegeoip.net/json/', type: 'POST', dataType: 'jsonp', success: function(location) { if (location.country_code === 'XY') { window.location.href = 'http://www.google.com';; } } } );  
</script>

That served my purpose (it diverted the site to google when being accessed in that particular country whose code is XY)     

Sorry for a late reply

 

0 Likes
New Member
2 0 0

Hi,

It seems that freegeoip is more often down than up though these days, isn't it? Are there any alternatives?

Thanks.

0 Likes
Shopify Expert
9765 86 1517

It's a free service so you can't be expect great uptime from it. IF you need a gelocation service that's more reliable expect to have to (rightly) pay for it.

Here's one:
https://www.maxmind.com/en/geoip2-services-and-databases

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
New Member
2 0 0

Thanks Jason, just signed up for a trial.

Cheers,

Thomas

0 Likes
New Member
1 0 1

Much easier aproach. You can use www.myipblocker.com. It can solve any country blocking and ip filtering issues.

Go to MyIPBlocker and sign up for an account. it's FREE (so far is donation based)
Add your website/s.
Enter the IP address(es) or/and countries you wish to block and the site will generate a code for you. 
Paste this code in the HTML (preferably inside the <head> tags along other javascript you migh have) and you are ready to go.
The nice thing about this site is that you can add addresses or change the redirect address and not have to change the code in your site. 
You paste it once and never again. Clever.

1 Like