Skip to end of metadata
Go to start of metadata

Introduction

The CityGrid Ad Performance API generates performance reports for developers, providing information on queries, clicks, impressions, click-through rates, coverage, revenue, and various additional metrics. Response formats include JSON and CSV. The webservice requires the user to authenticate using the same username and password used to log in to the reporting website.

Each reporting day is from 9:00 p.m. to 9:00 p.m., Pacific Time. For example, if a report is requested at noon on Friday for yesterday, the reporting range will be from 9:00 p.m. Wednesday evening through 9:00 p.m. Thursday evening.

Contents

Audience

The Ad Performance API is intended for developers of web and mobile applications who place ads from CityGrid into their applications to earn credit when the advertisement is clicked. The API serves as a reporting tool to monitor the performance of such ads.

HTTPS Endpoint

The API is accessed at the following endpoint with HTTPS GET:

Request

Request Parameters

The supported query parameters are as follows:

Parameter Name

Required

Default Value

Examples

Description

publisher_code

No

 

pub_seo
1234567

Specific publisher code for which to generate report. If no publisher code is specified, all publisher codes associated with the authenticated user are used.

placement

No

 

newyork_leaderboard

Specific placement for which to generate report. Multiple placement inputs can be specified in the request as separate placement parameters. If no placement is specified, all placements are used.

view_type

No

overall

overall
ads
placesThatPay

Specific view type for which to generate report.

report_time

No

yesterday

yesterday
last7Days
last14Days
last30Days
lastWeek
lastBusinessWeek
thisMonth
lastMonth
last3Months
thisQuarter
lastQuarter

Pre-defined date ranges for the report. If no report_time is specified the default is yesterday. 

Request Headers

The service accepts the following HTTPS headers:

Header Name

Required

Default Value

Example

Description

Accept

Yes

 

 

The desired output format. Possible values are:

  • application/csv — a simple CSV format
  • application/json — JSON format

Usage Examples

The following are examples of requests:

Type of Call

Example

Calling from curl with results in CSV

curl --user "<username>:<password>" --header "Accept: application/csv" "https://api.citygridmedia.com/ads/performance/v2/daily?publisher_code=guest&placement=placement_1&placement=placement_2"

Calling from curl with results in JSON

curl --user "<username>:<password>" --header "Accept: application/json" "https://api.citygridmedia.com/ads/performance/v2/daily?publisher_code=guest&report_time=lastWeek&view_type=ads"

Response

Response Codes

The response may contain one of the following HTTPS response codes:

HTTPS Status

Description

200 OK

Success

400 Bad Request

One or more parameters were invalid

401 Unauthorized

The user did not provide a valid username/password

403 Forbidden

The authenticated user does not have access to requested publisher code

406 Not Acceptable

The media type requested in the Accept header is not supported

500 Server Error

Internal server error

Response Data

If successful, a response body will contain report data in JSON or CSV. The report data contains the following properties:

Property

Parent

View Type

Description

view_type

 

 

Request view type. If no view type was specified in the request, this will default to 'overall'.

placements

 

 

Request placements. If no placements were specified in the request, this will be null.

from

 

 

Start date to which this report applies.

to

 

 

End date to which this report applies.

publisher_codes

 

 

List of publisher codes used to generate report. If no publisher code was specified in the request, all publisher codes associated with the authenticated user are returned.

daily_results

 

 

Element containing daily metric information.

date

daily_results

 

Date of this metric.

billable_connections

daily_results

overall

Billable connections for this date metric.

impressions

daily_results

ads
placesThatPay

Queries for this date metric.

bidded_impressions

daily_results

ads

Ad impressions for this date metric.

billable_clicks

daily_results

ads

Ad clicks for this date metric.

revenue

daily_results

 

Revenue for this date metric.

rpm

daily_results

ads
placesThatPay

RPM for this date metric.

ctr

daily_results

ads

CTR for this date metric.

cpc

daily_results

overall
ads

CPC for this date metric.

coverage

daily_results

ads

Coverage for this date metric.

ltc

daily_results

 

LTC clicks for this date metric.

ltc_revenue

daily_results

 

LTC revenue for this date metric.

total_billable_connections

 

overall

Sum of billable connections for the report period.

total_impressions

 

ads
placesThatPay

Sum of queries for the report period.

total_bidded_impressions

 

ads

Sum of ad impressions for the report period.

total_billable_clicks

 

ads

Sum of ad clicks for the report period.

total_revenue

 

 

Sum of revenue for the report period.

total_rpm

 

ads
placesThatPay

Total RPM for the report period.

total_ctr

 

ads

Total CTR for the report period.

total_cpc

 

overall
ads

Total CPC for the report period.

total_coverage

 

ads

Total Coverage for the report period.

total_ltc

 

 

Sum of LTC clicks for the report period.

total_ltc_revenue

 

 

Sum of LTC revenue for the report period.

JSON Response

The following is an example response for seven days of reporting data with view_type=overall:

An example response for view_type=ads:

An example response for seven days of data with view_type=placesThatPay:

An example response when there is no data available for the provided request parameters:

CSV Response

The following is an example response for seven days of data with view_type=overall:

An example response for view_type=ads:

An example response for view_type=placesThatPay:

An example response when there is no data available for the provided request parameters:

Labels
  • None