Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
    • Graph API
    • FQL
    • Open Graph
    • Dialogs
    • Chat
    • Internationalization
    • Ads
  • Games
  • Media
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • Web
  • Technology Partners
  • Best Practices
    • Batch Requests
    • Using ETags
  • Reference
    • Conversion pixels
    • Cost Per Action (CPA) Ads
    • Currencies
    • Homepage Ads via API
    • Introduction to Action Spec
    • Introduction to Sponsored Stories
    • Mobile App Install Ads
    • Optimized CPM
    • Real Time Bidded Exchange protocol
    • Sponsored Results
    • Thrift file for Real Time Bidded Exchange protocol
  • Specs
    • Action Specs
    • Conversion Specs
    • Creative Specs
    • Targeting Specs
    • Tracking Specs
  • Advanced Targeting
    • Action Spec Targeting
    • Custom Audience targeting
    • Partner Categories
    • Topic Targeting
    • ZIP Code Targeting
  • Queries
    • Action Estimate
    • Action Spec Ad Previews
    • Ad Statistics
    • Autocomplete Data
    • Broad Target Categories
    • Connection Objects
    • Conversion Stats
    • Keyword Stats
    • Reach estimate
    • Targeting Description
  • Objects
    • Ad account
    • Ad account group
    • Ad campaign
    • Ad creative
    • Ad group
    • Ad image
    • Ad user

ZIP Code Targeting

Facebook APIs › Ads › ZIP Code Targeting

Introduction

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.

Location Targeting

ZIP code targeting is a feature of location targeting used in targeting_specs and can be utilized in conjunction with the other location parameters.


Usage

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.

Limitations

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.


Examples

Estimating Targeting Stats

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']}&currency=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
            }
        ]
    }
}

Creating an AdGroup

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"
}

Example: Getting an AdGroup’s Targeting Specs

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"
}
Updated about 10 months ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy