Filtering Website Intercept by IP Address

Website Intercept is available as an add-on. If you are interested in Website Intercept, please contact us for additional information.

Sometimes you may want to limit who is able to see your Website Intercept survey invitations. It may be that you are doing a slow rollout and want to only allow specified testers to see and interact with your Intercept invitations, or perhaps you've already integrated Website Intercept and don't want those within your organization to be solicited needlessly.

Gathering IP address information

Intercept beacons operate using JavaScript, and unfortunately IP address information is not available via JavaScript. The only place this information is available is on the server which received a request; if you control your server, you can simply include this IP address information in the page content you send back to the client, and then include it as Custom Data with your beacon.

If you cannot get this information from your own server

If you are unable to run or modify your own server-side scripts, or perhaps are not that committed to Website Intercept yet, the Internet unfortunately does not care; this information is only available server side. To work around this situation, a publicly available web service such as www.hostip.info can be a wonderful resource!

Using a simple AJAX call, you can request a visitor's IP address from HostIP's server, which is returned in JSON format by default. After you have received this information, just call your beacon code as normal, and pass along the IP as Custom Data.

$.get('http://api.hostip.info/get_json.php', function(data){
   (function(d,e,j,h,f,c,b){d.AlchemerBeacon=f;d[f]=d[f]||function(){(d[f].q=d[f].q||[]).push(arguments)};c=e.createElement(j),b=e.getElementsByTagName(j)[0];c.async=1;c.src=h;b.parentNode.insertBefore(c,b)})(window,document,'script','//d2bnxibecyz4h5.cloudfront.net/runtimejs/intercept/intercept.js','sg_beacon');
   sg_beacon('init','YOURBEACONCODEHERE');
   sg_beacon('data','ip',data.ip);
});

Please note that the above snippet relies on the jQuery JavaScript library.

Considerations for using external services

Please be a good netcitizen and do not abuse public services such as the one offered by HostIP; if your website will be receiving a large amount of traffic, consider making the adjustments necessary to have this data provided by your own webservers (which have received the HTTP request from your visitor anyway, so you may as well grab the IP info while it's freely available!). Additionally, even though it is a very tiny request (<0.5 KB), losing that extra HTTP request for every page load can help improve performance for your website, as well as reducing dependencies on external servers.

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In