Sometimes, you might want to block or bucket only visitors with a certain IP or within certain IP ranges.
For this solution, you will need a third party service to provide you with the IP address of your visitors.
There are plenty of solutions for this in the market. We do not recommend any specific one, but for this article we are going to use the service provided by https://ipapi.co/ for sample purposes.
1) First you need to add the following code to your Project Global Javascript section and configure it according to the comments to fit your needs:
See the Pen Blocking IP Ranges Global JS by Convert.com (@gcrewe) on CodePen.
2) You need to add the following JS Condition to your experience audience conditions you want this IP block to be enforced. You will need to AND it with any other audience conditions you may have
See the Pen IP Block JS Condition by Convert.com (@gcrewe) on CodePen.
The JS condition needs to be configure in the following way:
From here you experience will be blocked for users within the IP or range that you configured on the javascript code.
If you want to debug, you can type the show_experiences variable, on your browser console, to see if the script determined if you matched the IP or IP range you configured.
Comments