Reporting API V1

<!-- theme: danger -->

This API is deprecated and will be removed soon

The new API docs can be found here: https://apidocs.mediamath.com/docs/reporting-api-v2

<!-- theme: warning -->

Support for adama_cookie will be removed later this year. We ask all of our clients who have not yet migrated to OAuth2 authorization to do so as soon as possible.

The Reports API on MediaMath Platform allows advertisers to access, query and aggregate reporting data. It is also the API that powers all reporting seen on our MediaMath Platform flagship UI.

The Reports API offers a number of reports. Each report offers its own pre-aggregated, time-based metrics on entities that users can query. A query can filter, aggregate, sort, paginate, and format this data.

It is a read-only system meaning no request against it can alter the data in any way.

It is also a metadata-driven system. The supported reports are described in a human- and machine-readable format. This ensures easy one-off and repeatable programmatic data querying. It also provides a way for clients to adapt to changes in reports programmatically. This gives client-developers the ability to create UIs that provide useful operational feedback in a navigable and understandable way.

The $API_BASE for the latest version of Reports API is

https://api.mediamath.com/reporting/v1/std

Authentication

Fields

Report data is stored and output in a tabular format. This means that the output consists of rows and columns. Every row has a value for every column.

The structure object can be used to determine the columns a report can output. Its fields are divided among three mappings - time_field, dimensions, and metrics. Each mapping, maps field name to #model:Fqbi8siNTuFGqA2W5.

{
  
  "time_rollups" : [ "by_day", "by_week", "by_month", "all" ],
  "time_windows" : [ "yesterday", "last_X_days", "month_to_date", "campaign_to_date" ],
  "timezone" : "campaign timezone",
  "time_aggregation" : "by_day",
  "structure" : { 
    "time_field" : { 
      "date" : { 
        "name" : "Date",
        "type" : "datetime"
      }
    },  
    "dimensions" : {
      "campaign_id" : { ... },
      "campaign_name" : { ... },
      "strategy_id" : { ... },
      "strategy_name" : { ... }
    },  
    "metrics" : { 
      "clicks" : { ... },
      "impressions" : { ... }
    }
  }
  ...
}

Time Field

The time field represents the time-component of the report's metrics. There is (currently) only one time field for each report. It can be of one of these data types: datetime or interval. Its data type determines the type of report (datetime or interval based report).

Note: The type of report is not to be confused with the Type attribute. The Type attribute is purely informational.

The time field was distinguished from the dimension fields to allow its use in grouping and filtering rows easier to understand. It gets its own set of parameters and language.

datetime-typed Time Fields

Datetime-typed time fields contains a combination of year, month, day, and possibly down to hour, minute and second. The time_aggregation property indicates the field's finest grain (by_hour, by_day, etc). The time_rollups property indicates the available grouping options that can go beyond the time_aggregation of the report.

time_rollup=by_week     ### group rows by the week  -  week starts on Monday 
time_rollup=by_month    ### group rows by the month
time_rollup=all         ### produces at most one row of output per combination of dimension fields
                        ### listed in the dimensions parameter

The time field for these reports are typically represented in the output by a start_date and end_date column. The format of the column will depend on the time window and time_rollup.

  • YYYY-MM-DD
  • YYYY-MM-DD hh:mi:ss

The only exception to this rule is detailed in the Special Time Windows section.

The timezone of the start_date and end_date columns will match the timezone property.

interval-typed Time Fields

interval-typed time fields, contain a predefined non-calendar date based aggregation (1 day, 7 days, 30 days, and so on). In this case, the only accepted way to specify a time interval is by using the parameter time_window. The only value supported for the parameter time_rollup for interval-based reports is all.

The time field for these reports are represented in the output by a interval column. The value of the column will depend on the time_window chosen. The following gives example column values based on the time_window.

  • yesterday - 1
  • last_7_days - 7
  • last_30_days - 30
  • campaign_to_date - CTD
  • flight_to_date - FTD

Filtering with the Time Field

The API requires the specification of a time window in order to narrow the data set operated on. A time window must be specified in one of the two possible ways.

  • start_date and end_date (optional - defaults to "yesterday").
  • time_window may be set to one of the formats defined by the time_windows attribute.
###  operate on data timestamped between Jan 01, 2013 and Feb 01, 2013, inclusive
start_date=2013-01-01&end_date=2013-02-01  
###  operate on data timestamped between May 05, 2013 and yesterday, inclusive
start_date=2013-05-01  
###  other usage examples 
time_window=last_30_days 
time_window=month_to_date 
time_window=yesterday 
start_date and end_date

start_date and end_date may only be used when the report's time field is of the datetime type. They may not be used when the report's time field is of the interval data type. This is because the time_windows are pre-defined intervals that cannot be split.

The start_date and end_date parameters define inclusive boundaries for the data. In order to ease the burden of calculating an inclusive end, the inputs may be specified at various granularities.

  • month - YYYY-MM
  • day - YYYY-MM-DD
  • hour - YYYY-MM-DDThh
  • minute - YYYY-MM-DDThh:mi
  • second - YYYY-MM-DDThh:mi:ss

Each granularity matches a substring of the ISO 8601 format.

If the report is at a coarser granularity (see time_aggregation) than the input, the input will be taken to mean the entirety of the time unit.

start_date=2016-04-12T01%3A30%3A00&end_date=2016-04-12T02%3A30%3A00
# ie. start_date=2016-04-12T01:30:00&end_date=2016-04-12T02:30:00
# For a report with a time_aggregation of by_hour:
# 2016-04-12T01:00:00 to 2016-04-12T02:59:59.
 
# For a report with a time_aggregation of by_day:
# 2016-04-12T00:00:00 to 2016-04-12T23:59:59
time_window

All values mentioned in the time_windows array will be accepted verbatim by the time_window parameter with the exception of any time window that starts with last_X_. They may be interpreted as such.

  • The last_X_days time window ends yesterday (inclusive) and starts X days before that.
  • The last_X_hours time window ends at the previous hour (inclusive) and starts X hours before that.

Future windows of this type may be defined following this nomenclature, but for different units. Rules for the time window may vary slightly.

Special Time Windows

The following time_windows are considered to be special time windows.

  • campaign_to_date
  • flight_to_date

For reports with a datetime-typed time_field, the start_date and end_date columns that would normally be present, will be replaced by the interval column. Additionally, the following validation rules apply when a special time_window is chosen.

  • The results will have an interval column instead of start_date and end_date columns.
  • The time_rollup parameter must be set to all.
  • Any mention of the time_field for the report in the order parameter will be rejected.

Dimension Fields

Dimension fields describe an entity. The example reports provide dimension fields for campaign, and strategy entities. Dimension fields are used to group rows during aggregation in conjunction with the time field.

Metric Fields

Once the rows have been grouped. The metric fields are calculated based on the values of the group's underlying rows. These calculations are generally sums or averages. These fields are usually a numeric data type.

Please note that fees (eg: managed_service_fee, optimization_fee, platform_access_fee, and mm_total_fee), cost (eg: adserving_cost, adverification_cost, media_cost, and tota_ad_cost), and margin data are only available to users who have “edit margin” access.

Data Types

The id type allows any character except whitespace.

The datetime type may be filtered by dates, or datetimes in either of the following ISO 8601 based formats.

  • date - YYYY-MM-DD
  • datetime - YYYY-MM-DDThh:mi:ss

Year, month, and day are all 1-based. Hour, minute, and second are all 0-based. Valid hours are 0-23.

The dimension fields of the datetime type will always be output in the aforementioned datetime format. The output columns for the time field will be output in the same format, but without the separating 'T'.

Field Data Type Groupings

This documentation may refer to multiple data types via a group name. The following table details the group names.

GroupData Types
floatfloat, money, percent, ratio
integerinteger, count, rank
numericfloat and integer groups
datedatetime
stringstring, interval
idid
boolbool, boolean
Download OpenAPI description
Languages
Servers
Mock server
https://apidocs.mediamath.com/_mock/apis/reporting-api-v1/
https://api.mediamath.com/reporting/v1/std/

Data Retrieval

_

Operations

Metadata

_

Operations

Reports List

Request

<!-- theme: danger -->

This API is deprecated and will be removed soon

The new API docs can be found here: https://apidocs.mediamath.com/docs/reporting-api-v2

In order to obtain a list of reports which are currently supported by the Reports API, issue the following API call:

$API_BASE/meta

All metadata in Reports API is represented in JSON format (content-type: application/json; charset=UTF-8). The schema for the response follows the example.

Reports Meta

The example has been formatted for easy reading.

{
    "reports": {
        "app_transparency": {
            "Description": "Standard performance metrics broken out by App ID. Non-app inventory shown as N/A app_id",
            "Name": "App Transparency Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/app_transparency",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/app_transparency/meta",
            "Version": 1
        },
        "audience_index": {
            "Description": "Special index metrics for comparing your ads' viewers to 3rd party segments.  Broken out by audience name, as well as standard dimensions down to campaign and strategy.  Currently available in one interval: last 14 days.",
            "Name": "Audience Index Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/audience_index",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/audience_index/meta",
            "Version": 1
        },
        "audience_index_pixel": {
            "Description": "Special index metrics for comparing your site visitors to 3rd party segments.  Broken out by audience name and pixel.  Currently available in one interval: last 14 days.",
            "Name": "Audience Index Pixel Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/audience_index_pixel",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/audience_index_pixel/meta",
            "Version": 1
        },
        "by_hour": {
            "Description": "Standard performance metrics broken out by standard dimensions, available in precise time windows - down to the hour - with the option to aggregate by hour or day.",
            "Name": "By Hour Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/by_hour",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/by_hour/meta",
            "Version": 1
        },
        "contextual_insights": {
            "Description": "Standard performance metrics broken out by contextual categories that strategies are targeting",
            "Name": "Contextual Insights",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/contextual_insights",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/contextual_insights/meta",
            "Version": 1
        },
        "data_pixel_loads": {
            "Description": "Loads and Uniques metrics for data pixels, broken out by referrer and referrer rank, available by day.",
            "Name": "Data Pixel Loads Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/data_pixel_loads",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/data_pixel_loads/meta",
            "Version": 1
        },
        "day_part": {
            "Description": "Standard performance metrics broken out by time of day and day of week. Available in standard intervals.",
            "Name": "Day Part Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/day_part",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/day_part/meta",
            "Version": 2
        },
        "device_technology": {
            "Description": "Standard performance metrics broken out by technology dimensions including browser, operating system, and connection type.  Available in custom date ranges or intervals with the option to aggregate by day, week, or month.",
            "Name": "Device Technology Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/device_technology",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/device_technology/meta",
            "Version": 1
        },
        "event_pixel_loads": {
            "Description": "Loads and Uniques metrics for event pixels, broken out by referrer and referrer rank, available by day.",
            "Name": "Event Pixel Loads Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/event_pixel_loads",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/event_pixel_loads/meta",
            "Version": 1
        },
        "geo": {
            "Description": "Standard performance metrics broken out by geographic dimensions including country, region, and metro area.  Available in standard intervals.",
            "Name": "Geo Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/geo",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/geo/meta",
            "Version": 2
        },
        "hyperlocal": {
            "Description": "Standard performance metrics broken out by Hyperlocal Targeting objects created via third party.",
            "Name": "Hyperlocal Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/hyperlocal",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/hyperlocal/meta",
            "Version": 1
        },
        "performance": {
            "Description": "Standard performance metrics in campaign currency and broken out by our widest array of dimensions.  Available in custom date ranges or intervals with the option to aggregate by day, week, or month.",
            "Name": "Performance Report in Campaign Currency",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/performance",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/performance/meta",
            "Version": 1
        },
        "postal_code": {
            "Description": "Standard performance metrics broken out by postal code. Only includes data for strategies that targeted or anti-targeted postal codes. Available in custom date ranges or intervals with the option to aggregate by day, week, or month.",
            "Name": "Postal Code Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/postal_code",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/postal_code/meta",
            "Version": 1
        },
        "reach_frequency": {
            "Description": "Basic performance metrics as well as the \"uniques\" metric, broken out by frequency of ad exposure.  Available in standard intervals.",
            "Name": "Reach and Frequency Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/reach_frequency",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/reach_frequency/meta",
            "Version": 1
        },
        "site_transparency": {
            "Description": "Standard performance metrics broken out by the domain of the inventory.  Available in standard intervals.",
            "Name": "Site Transparency Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/site_transparency",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/site_transparency/meta",
            "Version": 2
        },
        "video": {
            "Description": "Video-specific metrics such as completion rate, skips, and fullscreens broken out by a wide array of dimensions.  Available in custom date-ranges or intervals with the option to aggregate by day, week, or month.",
            "Name": "Video Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/video",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/video/meta",
            "Version": 1
        },
        "watermark": {
            "Description": "Watermark metrics show how many impressions and how much spend went towards the brain's learning activities.  Viewable by campaign and strategy dimensions and available by day.",
            "Name": "Watermark Report in US Dollars",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/watermark",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/watermark/meta",
            "Version": 1
        },
        "win_loss": {
            "Description": "Metrics describe the auction before a win or even a bid has taken place.  Broken out by strategy, exchange, and deal dimensions and available by hour.",
            "Name": "Win/Loss Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/win_loss",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/win_loss/meta",
            "Version": 2
        },
        "win_loss_creative": {
            "Description": "Metrics describe the auction before a win has taken place. Broken out by creative dimensions and available by hour.",
            "Name": "Win/Loss Creative Report",
            "URI_Data": "https://api.mediamath.com/reporting/v1/std/win_loss_creative",
            "URI_Meta": "https://api.mediamath.com/reporting/v1/std/win_loss_creative/meta",
            "Version": 1
        }
    }
}
Headers
Cookiestringrequired

_

Default adama_session=<<sessionid>>
curl -i -X GET \
  https://apidocs.mediamath.com/_mock/apis/reporting-api-v1/meta \
  -H 'Cookie: adama_session=<<sessionid>>'

Responses

Body*/*
reportsobject

Report Meta

Request

<!-- theme: danger -->

This API is deprecated and will be removed soon

The new API docs can be found here: https://apidocs.mediamath.com/docs/reporting-api-v2

The examples used in this section are truncated versions of https://apidocs.mediamath.com/docs/api/ZG9jOjMyMzMyNDMx. The use of "..." in an example is meant to indicate truncation of other properties. The Definition section of this endpoint provides information about how the metadata may vary from report to report. The Definition section of the https://apidocs.mediamath.com/docs/api/aa580375b0b65-report-data provides a reference to the query string parameters that it accepts.

Path
reportstringrequired

This must be a report discoverable from https://apidocs.mediamath.com/docs/api/0cee9f044b27b-reports-list.

Headers
Cookiestringrequired

_

Default adama_session=<<sessionid>>
curl -i -X GET \
  'https://apidocs.mediamath.com/_mock/apis/reporting-api-v1/{report}/meta' \
  -H 'Cookie: adama_session=<<sessionid>>'

Responses

Body*/*
Namestringrequired

This is the human-readable name of the report. It is not recognized by any API input.

Versionintegerrequired
Descriptionstring
URI_Datastring(uri)required
URI_Metastring(uri)required
Transitionobject
Deprecationobject
Typestring
currencystring

Provides information about the currency of the metrics fields typed as "money".

When set to "campaign currency", the currency varies from record to record. To determine the currency for a particular record, the campaign_currency_code dimensions field should be requested, if available for the report.

Any other value should be taken to be the currency for all records of the report.

data_retentionstring

Indicates how far back data is available. This can be a date, datetime, or time window as specified by the "time_window" and "Special Time Windows" sections of https://apidocs.mediamath.com/docs/api/a726318c29d15-reports-api. This property should be used very loosely. It may not be accurate. It is meant to give a general idea.

default_metricsArray of stringsrequired
structureobjectrequired
structure.​time_fieldobjectrequired
structure.​time_field.​property name*object(Field Description)additional property
structure.​dimensionsobjectrequired
structure.​dimensions.​property name*object(Field Description)additional property
structure.​metricsobjectrequired
structure.​metrics.​property name*object(Field Description)additional property
time_aggregationstring

This property indicates the finest granularity of the time_field. For reports with a time_field of the datetime type, this will be "by_hour", "by_day", etc. When the type is interval, this will be "various".

time_rollupsArray of stringsrequired

This property indicates the available levels of granularity for the time_field. It lists the valid values of the time_rollup parameter used for the https://apidocs.mediamath.com/docs/api/aa580375b0b65-report-data endpoint. For reports with a time_field of the datetime type, this tends to be a combination of "by_hour", "by_day", "by_week", "by_month", "all", etc. When the type is interval, this will only include "all".

time_windowsArray of stringsrequired
timezonestring

Provides information about the timezone of the time_field for the report.

When set to "campaign timezone", the timezone varies from record to record. To determine the currency for a particular record, the campaign_timezone dimensions field should be requested, if available for the report.

Any other value should be taken to be the timezone for all records of the report.

Reports

_

Operations