Last active
August 29, 2015 13:56
-
-
Save davidji99/9196006 to your computer and use it in GitHub Desktop.
This simple JS script, using an external site, allows you to prevent certain IPs from viewing an experiment for Optimizely Gold clients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| var myip; //declares variable to store IP address | |
| var doNotTest = ["012.345.678.9"]; //creates an array to store IPs, separated by a comma, that shouldn't see experiment | |
| </script> | |
| <script type="text/javascript" src="http://l2.io/ip.js?var=myip"></script> | |
| <script> | |
| for (ip in doNotTest) { //runs through each IP address in doNotTest | |
| if (myip != doNotTest[ip]) { //if this condition is met, experiment will run | |
| } | |
| }; | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment