...
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 |
|
Note |
---|
Arguments must be properly URL-encoded (spaces as %20 or +, ampersands as %26, and so on). |
...
- To define a geography, you must either specify where or client_ip. If you specify both, then where will be used, and client_ip will be ignored.
- For where, the Specifying Where section in the Places API topic provides more details.
- For client_ip, you may specify a radius to indicate a circle around the location of the IP address. If no radius is specified, then a radius of 25 miles is used.
Where Usage Examples
The following table provides some example uses of the Custom Ads API and their corresponding URL with query parameters. Click on the links to try them out.
Usage | URL | ||||||
---|---|---|---|---|---|---|---|
Return restaurants in Los Angeles | |||||||
Return restaurants for postal code 90069 | https://api.citygridmedia.com/ads/custom/v2/where?what=restaurant&where=90069&publisher=test | ||||||
Return restaurants for a user at IP address 4.74.197.0 | https:/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 | |||
sem_adgroup_id | Property for storing adgroup id you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | Generic Auto Parts | |||
sem_creative_id | Property for storing creative id for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | 75202492 Find Auto Repair Parts | |||
sem_query | Property for storing a query for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | pizza sporting goods | |||
sem_matched_keyword | Property for storing a matched keyword for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | construction | |||
sem_device | Property for storing the device for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | mobile device, desktop etc. |
Note |
---|
Arguments must be properly URL-encoded (spaces as %20 or +, ampersands as %26, and so on). |
Anchor | ||||
---|---|---|---|---|
|
Notes
- To define a geography, you must either specify where or client_ip. If you specify both, then where will be used, and client_ip will be ignored.
- For where, the Specifying Where section in the Places API topic provides more details.
- For client_ip, you may specify a radius to indicate a circle around the location of the IP address. If no radius is specified, then a radius of 25 miles is used.
Where Usage Examples
The following table provides some example uses of the Custom Ads API and their corresponding URL with query parameters. Click on the links to try them out.
Usage | URL |
---|---|
Return restaurants in Los Angeles | |
Return restaurants for postal code 90069 | https://api.citygridmedia.com/ads/custom/v2/where?what=restaurant&where=90069&publisher=test |
Return restaurants for a user at IP address 4.74.197.0 | |
Return up to 5 spas near zip code 90069 | https://api.citygridmedia.com/ads/custom/v2/where?where=90069&what=spa&publisher=test&max=5 |
Return up to 10 bars in Detroit. Note that 10 is the default maximum | https://api.citygridmedia.com/ads/custom/v2/where?where=Detroit,MI&what=bar&publisher=test |
Return up to 10 bakeries for whatever region the user with IP 23.110.26.29 resides | https://api.citygridmedia.com/ads/custom/v2/where?what=bakery&client_ip=23.110.26.29&publisher=test |
Return up to 10 pet businesses in Reno, telling CityGrid you would like this request logged under the placement identifier “magazine.” | |
Return up to 10 bars near zip code 90004, including an XML schema location with the results | https://api.citygridmedia.com/ads/custom/v2/where?where=90004&what=bar&publisher=test&schema=true |
Obtaining Custom Ads by Latitude and Longitude
The latlon endpoint returns custom ads using a geographic region defined by latitude and longitude.
LatLon HTTPS Endpoint
The following endpoint supports HTTPS GET:
Code Block |
---|
https://api.citygridmedia.com/ads/custom/v2/ |
...
Return up to 5 spas near zip code 90069
...
https://api.citygridmedia.com/ads/custom/v2/where?where=90069&what=spa&publisher=test&max=5
...
Return up to 10 bars in Detroit. Note that 10 is the default maximum
...
https://api.citygridmedia.com/ads/custom/v2/where?where=Detroit,MI&what=bar&publisher=test
...
Return up to 10 bakeries for whatever region the user with IP 23.110.26.29 resides
...
https://api.citygridmedia.com/ads/custom/v2/where?what=bakery&client_ip=23.110.26.29&publisher=test
...
Return up to 10 pet businesses in Reno, telling CityGrid you would like this request logged under the placement identifier “magazine.”
...
...
Return up to 10 bars near zip code 90004, including an XML schema location with the results
...
https://api.citygridmedia.com/ads/custom/v2/where?where=90004&what=bar&publisher=test&schema=true
Obtaining Custom Ads by Latitude and Longitude
The latlon endpoint returns custom ads using a geographic region defined by latitude and longitude.
LatLon HTTPS Endpoint
The following endpoint supports HTTPS GET:
Code Block |
---|
https://api.citygridmedia.com/ads/custom/v2/latlon
|
LatLon Request
The following query string parameters are used with the Custom Ads API latlon endpoint:
...
Parameter
...
Description
...
Required
...
Valid Values
...
Default
...
Examples
...
Notes
...
what
...
What a user is searching for
...
Yes
...
...
...
pizza
sporting%20goods
plumbers
...
...
lat
...
Latitude of the center of a circle for a geographic search
...
See Notes below
...
...
...
37.65056
...
...
lon
...
Longitude of the center of a circle for a geographic search.
...
See Notes below
...
...
...
-119.03639
...
...
radius
...
Radius of a circle search.
...
See Notes below
...
An integer between 1 and 50, inclusive
...
4
...
2
...
If radius is larger than 25, it defaults to 25
...
raw_what
...
The original user search phrase if available.
...
No
...
...
...
italian%20food
plumbing%20work
...
...
raw_where
...
The original user search phrase if available.
...
No
...
...
...
los%20angeles
...
...
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
yahoo
searchresults
...
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
+en-US%29+AppleWebKit%2F534.1%2B+%28KHTML%2C+like
+Gecko%29+Version%2F6.0.0.246+Mobile+Safari%2F534.1%2B
...
...
serve_url
...
The URL of the requested page
...
No
...
...
...
latlon
|
LatLon Request
The following query string parameters are used with the Custom Ads API latlon endpoint:
Parameter | Description | Required | Valid Values | Default | Examples | Notes |
---|---|---|---|---|---|---|
what | What a user is searching for | Yes |
|
| pizza |
|
lat | Latitude of the center of a circle for a geographic search | See Notes below |
|
| 37.65056 |
|
lon | Longitude of the center of a circle for a geographic search. | See Notes below |
|
| -119.03639 |
|
radius | Radius of a circle search. | See Notes below | An integer between 1 and 50, inclusive | 4 | 2 | If radius is larger than 25, it defaults to 25 |
raw_what | The original user search phrase if available. | No |
|
| italian%20food |
|
raw_where | The original user search phrase if available. | No |
|
| los%20angeles |
|
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 | ||
sem_adgroup_id | Property for storing adgroup id you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | Generic Auto Parts | ||
sem_creative_id | Property for storing creative id for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | 75202492 Find Auto Repair Parts | ||
sem_query | Property for storing a query for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | pizza sporting goods | ||
sem_matched_keyword | Property for storing a matched keyword for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | construction | ||
sem_device | Property for storing the device for you to optimize your marketing campaigns against, if you do marketing | No | Alphanumeric | mobile device, desktop etc. |
Note |
---|
Arguments must be properly URL-encoded (spaces as %20 or +, ampersands as %26, and so on). |
...