Intentionally or not, ZIP codes have become particularly useful for detailing definable community populace attributes. Most influential research on demographics, including the US Census, use zip codes as their most fine grained level of segmentation. As a result, ZIP codes are often used for determining demographic or other location and geographic based market strategies.
Targeting via ZIP codes brings about location targeting functionality to 5-digit ZIP codes within the United States, specified by the United States Postal Service (USPS), and opens up another avenue for advertisers to market to their desired audience.
ZIP code targeting is a feature of location targeting used in targeting_specs and can be utilized in conjunction with the other location parameters.
To implement ZIP code targeting with the Ads API, a new targeting_specs location parameter is used: zips. The zips parameter takes in an array of ZIP codes as strings, each one of length 5. Examples of ZIP codes include '94304' and '00501'.
The zips parameter is independent of all other parameters with exception of countries. In any given call that uses targeting_specs, specify zips as one of the input parameters:
zips=['94304','00501']
Note: the zips parameter must be a string - integer values will result in an error.
ZIP codes must be of the 5-digit variation; there is no current support for the extended ZIP+4 codes. When using ZIP code targeting (and also because international postal codes are not yet supported), the countries parameter must be set to 'US'. The radius parameter, which is normally associated with the cities parameter, also currently does not work in conjunction with ZIP code targeting. A maximum of 2,500 zips can be targeted in a single targeting spec.
The following example shows how zips might be used with the Graph method act_accountID/reachestimate to see the potential reach of the ad:
Graph API Sample
Request:
GET https://graph.facebook.com/act_11247574/reachestimate?targeting_spec={'countries':['US'],'zips':['94304','00501']}¤cy=USD&access_token=YOUR_ACCESS_TOKEN
Response:
{
"data": {
"users": 8180,
"bid_estimations": [
{
"resultType": {
...
},
"location": 3,
"cpc_min": 65,
"cpc_median": 86,
"cpc_max": 120,
"cpm_min": 48,
"cpm_median": 63,
"cpm_max": 88
}
],
"imp_estimates": [
{
"resultType": {
...
},
"location": 4,
"impressions": 51000
},
{
"resultType": {
...
},
"location": 3,
"impressions": 66000
}
]
}
}
The following example shows how zips might be used with the Graph method act_accountID/adgroups to create an ad that targets the specified ZIP codes:
Graph API Sample
Request:
POST https://graph.facebook.com/act_11247574/adgroups?campaign_id=6003275581288&name=TEST NAME&bid_type=1&max_bid=30&targeting={'countries':['US'],'zips':['94304','00501']}&creative={'type':2,'object_id':207038506006018,'name':'TEST NAME','body':'TEST BODY','image_hash':'02065c8aeb015168d66737c2966ff4f5'}&access_token=YOUR_ACCESS_TOKEN
Response:
{
"id": "6003525109088"
}
The following example shows how zips might be returned with the Graph method adgroupID to see an adgroup’s targeting specifications:
Graph API Sample
Request:
GET https://graph.facebook.com/6003525109088&access_token=YOUR_ACCESS_TOKEN
Response:
{
"adgroup_id": 6003525109088,
"ad_id": 6003525109088,
"campaign_id": 6003275581288,
"name": "TEST NAME",
"ad_status": 4,
"adgroup_status": 4,
"bid_type": 1,
"max_bid": "30",
"bid_info": {
"1": "30"
},
"account_id": 11247574,
"id": "6003525109088",
"creative_ids": [
6003525104288
],
"targeting": {
"zips": [
"00501",
"94304"
],
"countries": [
"US"
]
},
"start_time": null,
"end_time": null,
"updated_time": "2011-08-09T09:12:58+0000"
}