Custom Ads API
Introduction
As a CityGrid partner, you can place CityGrid ads on your web and mobile applications and get paid when your users click on them. Ads can be obtained by requests to the Custom Ads API, which provide you raw advertisement data in XML, leaving you free to customize all look-and-feel aspects of the display, including formatting, colors, and fonts.
Advertisements are requested by category and geography. Consider an application in which a user searches for "restaurants". The application has previously determined that the user is located in or near Santa Monica, CA, and has left that information in a cookie. The application can create relevant CityGrid advertisements by using "restaurants" and "Santa Monica, CA" as arguments when making a call to the Custom Ads API.
The Custom Ads API contains two endpoints: one for which the location is defined in terms of the name of a geographic region, and the other for which it is defined in terms of latitude and longitude.
Custom Ads by design contain no display information. If you wish to obtain pre-redendered ad units from CityGrid, see the Web Ads API for ads you can display on desktop browsers or the Mobile Ads API for ads you can display on mobile native and web applications.
Contents
Audience
The Custom Ads API is intended for developers of web and mobile applications who want place custom advertisements from CityGrid into their applications to earn credit when the advertisement is clicked. Custom advertisements are ads which do not contain display information; instead, publishers are free to match their application's look-and-feel when rendering ad data.
Version 2 Updates
Changes to results elements
Added impression id, i
The ad_destination_url is now an obfuscated URL. This URL will be decrypted and the proper redirect will take place when this link is followed.
Obtaining Custom Ads by Named Geographic Region
The where endpoint returns custom ads using a region (city, neighborhood, or metro) name or zip code. It is useful for free-form text and broad geographical region-based searches.
Where HTTPS Endpoint
The following endpoint is used with HTTPS GET:
https://api.citygridmedia.com/ads/custom/v2/where
Where Request
The following query string parameters are used with the Custom Ads API where endpoint:
Parameter | Description | Required | Valid Values | Default | Examples | Notes |
|---|---|---|---|---|---|---|
what | What a user is searching for | Yes |
|
| pizza |
|
where | The geographic location, generally a zip code or city-state pair | See Notes below | A zip code, city-state pair, or street address (Spaces are optional following the comma between a city and state) |
| 91011 |
|
raw_what | The original user search phrase if available. | No |
|
| italian%20food |
|
raw_where | The original user search phrase if available. | No |
|
| los%20angeles |
|
radius | Radius of a circle search using client_ip. | No | An integer between 1 and 25, inclusive | 25 | 2 | If radius is larger than 25, it defaults to 25 |
publisher | The publisher code that identifies you | Yes |
|
| acme | This parameter is required so that we know who to credit |
max | The Number of ads that you want to be returned | Yes | Integers, 1 through 10 | 10 | 3 | Values over 10 will only return 10 results |
placement | An optional property for storing additional information you would like CityGrid Media to log for this view | No |
|
| google | An example: if you are re-syndicating advertisements, you can use this parameter to record the ultimate destination for the advertisement. If you are placing CityGrid advertisements on your own site, you can record where on your site the advertisement will be placed |
mapping_url | A callback URL | No |
|
| See #Mapping URL for more information. | |
client_ip | The IP address of your client | See Notes below | IPv4 or IPv6 |
| 17.148.221.102 | This is used to determine a geography if the where parameter is not supplied |
user_agent | The version of browser or device the ad is served on | No |
| The user agent value from the request header | Mozilla%2F5.0+%28BlackBerry%3B+U%3B+BlackBerry+9800%3B |
|
serve_url | The URL of the requested page | No |
|
| http%3A%2F%2Fnational.citysearch.com%2Fprofile%2F10843791 |
|
sem_network | Property for storing the network for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric |
| Google, Bing, Ezanga etc. |
|
sem_network_source | Property for storing network source for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric |
| Search network, Run of network, google.com etc. |
|
sem_affiliate_id | Property for storing an affiliate id for you to optimize your marketing campaigns against, if you do marketing | No | Integer |
| Publisher id e.g. 3 |
|
sem_sub_affiliate_id | Property for storing sub-affiliate_id for you to optimize your marketing campaigns against, if you do marketing | No | Integer |
| Sub-publisher id e.g. 21 |
|
sem_campaign_id | Property for storing campaign id for you to optimize your marketing campaigns against, if you do marketing | No | Integer |
| 45723 |
|