0151 355 4555



Identifies a country from a customer's contact details. All the available details for the customer should be supplied as part of the CountryDetectionInput structure passed as the request argument - the more information that is supplied the more accurate the country detection process will be.

The details of the detected country are provided in the CountryDetectionOutput structure. If no country could be identified, the country name and ISO code are both set to "Unknown".

View all Country Detection methods

Code Samples

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="https://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">

<script type="text/javascript">

function loadIntegr8() {
  // Load the CountryDetection Integr8 service

function DetectCountry(request) {
  /// <param name="request">data8.countrydetectioninput. Set up the Address, Postcode, Country, EmailAddresses, TelephoneNumbers, IPAddress properties before calling this method.</param>
  var countrydetection = new data8.countrydetection();

function showDetectCountryResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.CountryName
    //   Contains the ISO standard name of the detected country
    // result.CountryISO
    //   Contains the 2-character ISO code of the detected country
    // result.IDC
    //   Contains the international telephone dialling code of the detected country
    // result.CCTLD
    //   Contains the country-code top level domain name of the detected country