Guides

Demographics

Each authenticated profile includes an optional demographic which can be used to increase the accuracy of any analysis. This data is not collected automatically. Your app can choose to GET or POST this demographic via the Sahha API.

All values are optional

String values are case insensitive (for example: 'us' and 'US' are equal and valid).

age : Int

Age must be a valid Int between 1 - 99.

gender : String

Gender must be a valid String from this list:

  • 'male'
  • 'female'
  • 'gender diverse'

country : String

Country must be a valid 2 character ISO String from this list:

ISO Country Codes

birthCountry : String

Birth Country must be a valid 2 character ISO String from this list:

ISO Country Codes

ethnicity : String

Any String value.

occupation : String

Any String value.

industry : String

Any String value.

incomeRange : String

Any String value.

education : String

Any String value.

relationship : String

Any String value.

locale : String

Any String value.

livingArrangement : String

Any String value.

birthDate : String

Birth Date must be a String in the format 'YYYY-MM-DD'. For example, '1990-05-20'.


Using the API for Demographics

You can GET or POST demographic info via the API using this model.

// All values are optional
class SahhaDemographic {
public var age: Int?
public var gender: String? // "male", "female", "gender diverse"
public var country: String? // ISO 2 character code, i.e. "us", "uk", "au", etc.
public var birthCountry: String? // ISO 2 character code, i.e. "us", "uk", "au", etc.
public var ethnicity: String? // any string
public var occupation: String? // any string
public var industry: String? // any string
public var incomeRange: String? // any string
public var education: String? // any string
public var relationship: String? // any string
public var locale: String? // any string
public var livingArrangement: String? // any string
public var birthDate: String? // must be in format "YYYY-MM-DD", i.e. "1990-05-20"
}

POST

An example POST of demographic info via the SDK.

var demographic = SahhaDemographic(
age: 32,
gender: "Female",
country: "NZ",
birthCountry: "UK",
birthDate: "1990-05-20"
)
Sahha.postDemographic(demographic) { error, success ->
if (error != null) {
println(error)
} else {
println(success.toString())
}
}

GET

An example GET of demographic info via the SDK.

Sahha.getDemographic() { error, demographic ->
if (error != null) {
println(error)
} else if (demographic != null) {
println(demographic)
}
}