Comment on page

Hide the shipping banner based on visitor location

If you're running a split test, for example, only in the Germany & Austria then you likely will not want visitors from other countries to see a "Free shipping over €50" banner.
Below we have some javascript you can include that will hide the banner for all visitors from outside of Germany or Austria.
You will need to modify line #4 so that it's an array of the countries included in the current test.
We recommend placing this script just before the closing </head> tag but it can safely be placed anywhere including an external javascript file.
<script type="text/javascript" src=""></script>
<script type="text/javascript">
/* Set these variables */
var shipScoutIncludedCountryCodes = ["DE", "AT"] //include alpha-2 country codes
/* Do not modify code below */
var shipScoutProcessCountry = function(countryCode) {
window._shipScout = window._shipScout || [];
_shipScout.push(function(response) {
// Check to see if the visitor's country is NOT in the included countries list
if (shipScoutIncludedCountryCodes.indexOf(countryCode) === -1) {
//hide the ShipScout banner
console.log("ShipScout: Banner hidden for visitors in " + countryCode)
document.querySelectorAll('.shipscout-banner').forEach(function(banner) { = 'none'
//Check for "sc_country" cookie
if (Cookies.get('sc_country')) {
} else {
// Make a request to ipinfo
var shipScoutXhr = new XMLHttpRequest();"GET", '/browsing_context_suggestions.json');
shipScoutXhr.onreadystatechange = function() {
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
var data = JSON.parse(shipScoutXhr.responseText)
if (data && data.detected_values && && {
} else {
console.log('ShipScout: Error with country lookup')
} else {
console.log('ShipScout: Error with country lookup request')