Analytics Reports API
The Analytics Reports API gives Pixalate Analytics subscribers programmatic access to the reports they see in the Analytics dashboard. You choose a report, write a short SQL-like query that names the dimensions and metrics you want, and get the rows back as JSON or as a downloadable CSV file.
Before you start
This API uses API key authentication only. Username and password credentials are deprecated for it. If you were onboarded with a username and password, ask your Pixalate account manager for an API key, and see Migrating from legacy APIs.
The API has two endpoints:
Make your first request
This request returns the top 10 ad domains by gross ad counts for one day, from the default dashboard report:
--get with --data-urlencode makes curl URL-encode each value and append it to the URL. The q value must be URL-encoded because it contains spaces, quotes and comparison operators. The request curl sends looks like this:
The query syntax is documented in Query language.
Read the response
A successful request returns 200 OK with a JSON object:
Values in the example are illustrative. Rate metrics such as givtSivtRate are returned as fractions, so 1 means 100%.
Add pretty=true to get indented JSON. The default is false.
Choose a report
The reportId path segment selects the report to query.
- Use
defaultfor the default analytics report. This is the Dashboard report you see when you first log in to the Pixalate dashboard. - For any other dashboard report, use its report ID. You can find it in the Analytics dashboard URL (the
reportId=value) while you view that report. - The Brand Safety report always needs its own report ID.
The examples on this site use these report IDs:
There is no endpoint that lists the reports available to your account. If you can’t find the ID of a report you need, contact support@pixalate.com.
Check your quota and data freshness
Call the base URL without a report ID to see your quota state and when the reports database was last updated:
This endpoint doesn’t return the dimensions and metrics you can query. Those are listed in Query language and in the Get analytics report reference.
Query parameters
These are the query parameters for GET /analytics/reports/{reportId}.
Set the date range
Filter on the day dimension in the WHERE clause of q. Dates use the yyyy-mm-dd format inside single quotes. The examples on this site all use this pattern:
For a single day, use the same date twice. The timeZone parameter sets the time zone the report data is synced in, as an integer number of minutes from GMT. The default, 0, is UTC.
Page through results
Use start and limit to read results a page at a time. numFound in the response tells you how many items there are in total.
Send the same q for every page, increase start by limit each time, and stop when start reaches numFound. If the result is too large to page through, export it to CSV instead.
Export to CSV
Add exportUri=true and the API returns a URI to the CSV data instead of the data itself:
The response is the URI of the CSV file, for example:
The CSV resource is public: anyone who has the URI can download it. The URI contains a randomly generated identifier, so the data stays relatively secure as long as you don’t make the URI itself public.
Run an export asynchronously
Add isAsync=true (together with exportUri=true) to get the CSV URI back immediately while the report is processed in the background. limit is ignored.
Request the export
Send the request with exportUri=true and isAsync=true. The API returns the CSV URI right away.
Export a large result set
For very large results, add isLargeResultSet=true (together with exportUri=true). Processing works exactly as it does with isAsync=true: you get a URI back immediately and poll it until it stops returning 404. The difference is the file. It contains a single column, and each row is the URL of a CSV file that holds part of the data. Download every file in the list to get the full result. limit is ignored.
Large results that use ORDER BY may return 400 Bad Request. If that happens, remove the ORDER BY clause.
Output formats
Errors
For behavior shared by all Pixalate APIs, see Quotas, limits and errors.
Worked examples
Each example is a complete request. For more queries, including filters on specific values and text matching, see the query language examples.
By advertiser
By fraud type
Supply path
Brand safety
The default Dashboard report, grouped by advertiser:
Related
Questions? Contact support@pixalate.com.