Edit in JSFiddle

dbip.getVisitorInfo().then(function(info) {
  if (info.isEuMember) {
    // Only show useful warning to visitors from EU member countries
    showCookieConsent();
  }
  showVisitorInfo(info);
});

function showCookieConsent() {
  $("#cookieConsent").text("By looking at this page you are agreeing to our use of cookies.");
}

function showVisitorInfo(info) {
  $("#country").text(info.countryName + " [" + info.countryCode + "]");
  $("#stateProv").text(info.stateProv);
  $("#city").text(info.city);
}
Country: <span id="country"></span><br />
State/Region: <span id="stateProv"></span><br />
City: <span id="city"></span><br />

<div id="cookieConsent"></div>

<script src="https://cdn.db-ip.com/js/dbip.js"
  data-api-key="p6bcac47ae71f0285cb6343d9697e56e41a2cb92">
</script>