0151 355 4555

GetDemographics

Description

Returns the Geo-Demographics code and details in a DemographicsOutput object for the requested postcode.

Note that a return value of false does not necessarily indicate that the person does not live at the address given. A person may be opted-out of the edited electoral roll and may not appear on the other data sources used to supplement the electoral roll, but may still be a resident at the address.

View all Lifestyle profiles 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>

<script type="text/javascript">

function loadIntegr8() {
  // Load the Demographics Integr8 service
  data8.load('Demographics');
}

function GetDemographics(postcode) {
  /// <param name="postcode">string</param>
  var demographics = new data8.demographics();
  
  demographics.getdemographics(
    postcode,
    null,
    showGetDemographicsResult
  );
}

function showGetDemographicsResult(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.SonarCode
    //   Contains the full Sonar code.
    // result.Title
    //   Contains the title of the Sonar code.
    // result.PercentageOfHouseholds
    //   Shows the percentage of the UK who fit into this Sonar code.
    // result.Lifestage
    //   Contains the Lifestage from A (Young Singles) to F (Retired).
    // result.WealthQuartile
    //   Contains the Affluence Quartile from 1 (Affluent) to 4 (Struggling).
    // result.WealthRanking
    //   Contains the Wealth Ranking from 1 (Wealthiest) to 100 (Poorest)
    // result.Description
    //   Contains a detailed textual description for the type of person that typically lives in this postcode
  }
}

loadIntegr8();

</script>