Skip to content

Instantly share code, notes, and snippets.

@davidji99
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save davidji99/9196006 to your computer and use it in GitHub Desktop.

Select an option

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.
<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