API Example Admin Daily Performance Report

From InClickAdServer

Administrator Report - Daily Performance

This API Service Reqeust will generate the Daily Performance Report data based on the provided filter options. =The Code Example

Breaking Down the Code

This require references the local inClick Ad Server deployment configuration files allowing your code to utilize the pre-packaged API Objects as well as the bundled PHPOlait services.


These requires (includes) contain the API Objects and Classes needed for this API Service Request.


The $base_url is the URL to your inClick Ad Server deployment, the ad server root URL. For local host API usage, the constant of INCLICK_WEB_URL is defined in the globals.php file referenced earlier. Remote deployments, deployments where the ad server and API Request Location are not on the same server, would change this to the fully qualified URL to the ad server root directory.

The $service_key is one of the the api_service_keys values you created for your ad server. (more information)


This is where we create an instance of the classes needed to perform this service request.


These three lines are used to set the date range. Line one is to set the date in the past. In this case, it is set for 13 days ago. Line two is the current server time. The third line sets the date range object with two parameters, the starting date and the ending date. in this example, we are looking at the last 14 days of data (including today).

WARNING: Values for $report_request->setDateRange are integer timestamps. Do not enter date formatted values! For example, the timestamp value for May 24, 2023 is 1684900800.

These five lines are used to set the various optional filter options:

Object Required Description
setResultsPerPageNoThis numeric value will determine how man results will be returned in this request. Typically, this is the number of results to show in a page.
setCurrentPageNoThis numeric value will tell the server what page to retrieve.
setAdvertiserIDNoThis numeric value, the advertisers account number, will filter the report to this advertisers activity
setChannelIDFilterNoThis numeric value, the channel ID, will filter the report to this channels activity
setPublisherIDNoThis numeric value, the publishers account number, will filter the report to this publishers activity.

This line is the API Service Request that sends the request for this report to your inClick Ad Server deployment. If a failure occurs, the error code and corresponding error message are returned as objects:

$report_result->getErrorCode()
$report_result->getErrorMessage()

If this request is successful, the report data assigned is available in the following object:

$report_result->getReturnValue()

This section of code is provided to give you a visual confirmation of what occurred, or to let you know what error occurred.