Targeting API
This API is used to obtain detailed targeting information for a project.
For each survey that you want to target, you should invoke the targeting command to see the qualifiers needed for that survey.
Command
"livealert/targeting/1"
Recommended Frequency
Make subsequent calls to this API anytime the "lastModified" field returned to you in the outputs of the inventory or targeting command is more recent than the last time you checked.
Output Info
All project values in inventory API, except for the "datapoints" key, are duplicated here exactly as they appear in the inventory API.
Datapoint Examples:
Datapoint Types 0,1,2,13: Single Selection and Multiple Selection targeting.
{
"name" : "Household Income",
"values" : [{
"choice" : 2
}, {
"choice" : 3
}, {
"choice" : 4
}, {
"choice" : 5
}]
}
The choice value refers to the element in position i of the answers array, which is a zero-based array.
In the above example, the survey is targeting the "Household Income" datapoint, and only looking for respondents who selected options 2,3,4,5 (15K-99K).
Datapoint Types 15: Age range
{
"name" : "Age",
"values" : [{
"max" : 35,
"min" : 18
}, {
"max" : 45,
"min" : 35
}]
}
Datapoint Types 16: List of postal codes
{
"name" : "List of Zips",
"values" : [{
"freelist" : "98115,98116,98117,",
"freelistFilename" : "zips.txt"
}]
}
{
"name" : "List of Zips",
"values" : [{
"freelist" : "981*,982*,97234",
"freelistFilename" : "zips.txt"
}],
"usesWildcards" : true
}
Datapoint Types 17: Children (gender/ages)
{
"name" : "Children",
"values" : [{
"gender" : 1,
"max" : 10,
"min" : 5
}, {
"gender" : 2,
"max" : 10,
"min" : 5
}]
}
The Children datapoint values may include these fields in the elements of the array:
- gender. Gender of the child. 0=any, 1=male, 2=female. If missing, then it is any.
- max. Maximum age of the child.
- min. Minimum age of the child.
- unit. Unit in which max and min values are given. 0=years, 1=months. If missing, then it is years.
Datapoint Types 18: List of zip+4 codes
{
"name" : "List of Zip+4",
"values" : [{
"zip4list" : [981151234, 981161111, 981172222],
"zip4listFilename" : "zips4.txt",
"ziplist" : [98115, 98116, 98117]
}]
}
Inputs
The following values are expected in the JSON body:
Name | Type | Required | Description |
---|---|---|---|
command | String | Must be "livealert/targeting/1" |
|
rfg_id | String | Survey identifier |
|
zipsOnly | Boolean | When zipsOnly is true, it will convert any of our geo datapoints to postal codes. The default value is false. |
Outputs
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
datapoints | JSON[] | Array of datapoints. Note that the "datapoints" key in inventory API is an array of Strings (just the names of the datapoints), whereas here, the "datapoints" value is an array of JSONs, which contains the detailed description of the targeting:
|
|||||||||||||||
quotas | JSON[] | Array of quotas, which contains the detail description of quotas for the project. When validating if a panelist is a match for this survey, keep in mind that all the matching quotas for a panelist must be open, otherwise the panelist will be rejected. (This field will only be present if the project has quotas) quotas:
|
|||||||||||||||
quotaLimitBy | String | Indicates if the quota limits are set by completes or starts. The possible values are:
(This field will only be present if the project has quotas) |
|||||||||||||||
quotaThrottle | Integer | We have introduced quota throttling to prevent over sampling on a some of our quotas. If the quota value returns quotaThrottle:1 then the quota is at its limit, and you should check the project again in 10 minutes to see if the quota has re-opened for new respondents. (This field will only be present if the project's quota is currently throttled) |
|||||||||||||||
excludeNonMatching | Boolean | Indicates if respondents not matching any quotas will be rejected. (This field will only be present if the project has quotas) |
|||||||||||||||
recontacts | String[] | Array of strings that contains the rids of the respondents that can enter this survey. You should redirect only those respondents, anyone else will be rejected. This value is only present if it is a recontact project. |
|||||||||||||||
phoneSupported | Integer | 0 - Unknown (We do not know if the survey accepts phones) 1- The survey accepts phones 2 - The survey does not accept phones |
|||||||||||||||
tabletSupported | Integer | 0 - Unknown (We do not know if the survey accepts tablets) 1- The survey accepts tablets 2 - The survey does not accept tablets |
Example Command
{
"command": "livealert/targeting/1",
"rfg_id": "RFG605150-001",
"zipsOnly": true
}
Example Response
{
"command":"livealert/targeting/1",
"response":{
"rfg_id":"RFG605150-001",
"title":"We'd love your help in this survey!",
"country":"CA",
"cpi":"$.49",
"estimatedIR":20,
"estimatedLOI":0,
"endOfField":"2017-06-02T00:00:00",
"desiredCompletes":10,
"currentCompletes":0,
"collectsPII":false,
"state":3,
"datapoints":[
{
"name":"Age",
"values":[
{
"min":25,
"max":34
}
]
},
{
"name":"Gender",
"values":[
{
"choice":2
}
]
},
{
"name":"List of Zips",
"values":[
{
"freelist":" \"S6K0B3\" , \"S6K0B1\" , \"S6K0A9\" , \"S6K0A7\" , \"S6K0A5\" , \"S6K0A6\" , \"S6K0A3\" , \"S6K0A1\" , \"S6K0A2\" , \"S6K1B7\" , \"S6K1B8\" , \"S6K1B5\" , \"S6K1B6\" , \"S6K1B3\" , \"S6K1B4\" , \"S6K1B1\" , \"S6K1B2\" , \"S6K1A8\" , \"S6K1A9\" , \"S6K1A6\" , \"S6K1A7\" , \"S6K1A4\" , \"S6K1A5\" , \"S6K1A2\" , \"S6K1A3\" , \"S6K1A1\" , \"S6K1C5\" , \"S6K1C2\" , \"S6K1C3\" , \"S6K1C1\" , \"S6K1B9\""
}
]
}
],
"lastModified":"2017-05-03T17:52:35",
"quotaLimitBy":"completes",
"excludeNonMatching":false,
"quotas":[
],
"phoneSupported":2,
"tabletSupported":2,
"isRecontact":false
},
"result":0
}