cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

PURPOSE

MediaMath provides a REST API for many different operations within their platform.  This includes a reports API for downloading data for analytics.  This post describes how to use Sisense's REST API Framework to authenticate & download data from MediaMath.

REQUIREMENTS & API SETUP

 This is a required part of Sisense's REST API framework which facilitates reading the data properly.  You will also need the .NET framework version 4.5.2 or above (you can check this under add/remove programs)
MediaMath Partners account.  You will need this account to access MediaMath's Developer Documentation.
The connector uses Cookie Based Authentication which requires an API key.  See documentation for Obtaining a T1 API Key.  Note: Key should be valid for this API: "MediaMath Partners: Standard MediaMath Partner"

INSTALLING THE CONNECTOR

  1. Download the connector here.
  2. Unzip the file.
  3. Copy the unzipped folder (named REST.MM, which should contain a config.json file and a Sisense.Connectors.RestConnector.dll file) to the your Sisense directory, located at the directory listed below.
  4. Inside the resulting folder, open config.json with any text editor (eg. Notepad++).  In the first section under Parameters, edit the api_key, user, password, and advertiser_id properties to reflect your account's credentials.
...\Program Files\Sisense\DataConnectors\DotNetContainer\Connectors

TABLES

The reports API has several endpoints for pulling different data.  See Reports API Documentation for reference.
In this connector, we have configured the Performance report and the Geo Report, both for a single Advertiser ID (specified under the Settings > Parameters section in the config.json file).  Alternatively, you could load tables for multiple Advertiser IDs, by modifying this parameter to organization_id for example (you would need to change this both under settings and in the tables sections of the config.json file).

MODIFYING THE CONNECTOR

There are a few sections of the config.json file that can be modified to suit your needs.  First, are the credentials, found under parameters.  You should only change the settings for api_key, user, password, and advertiser_id.  
"Settings": {
 "Provider": "rest.mediamath.connector",
 "DisplayName": "MediaMath",
 "MaxDocs": 100,
 "FetchSize": 1000,
 "Parameters": {
 "uri": "https://api.mediamath.com",
 "api_key": "enter api key here",
 "user": "enter username here",
 "password": "enter password here",
 "advertiser_id": "enter advertiser_id here"
 }
 },
Second, the tables section can be modified to include other fields / reports or change the filters or granularity for the existing reports.
"Tables": [
 
 {
 "Name": "Performance - Single Advertiser",
 "Public": "True",
 "Schema": "Https",
 "Method": "GET",
 "Base": "[@Settings.Parameters.uri]",
 "Path": "reporting/v1/std/performance",
 "Headers": {},
 "PathParameters": [],
 "QueryParameters": {
 "api_key":"[@Settings.Parameters.api_key]",
 "start_date": "2014-03-01",
 "time_rollup": "by_day",
 "dimensions": "campaign_name, campaign_id, advertiser_name, attribution_group, campaign_goal_type, concept_name, creative_name, creative_size, strategy_channel, strategy_goal_type, strategy_name, strategy_type", 
 "having": "advertiser_id=[@Settings.Parameters.advertiser_id]",
 "metrics": "impressions, clicks, total_spend, post_click_conversions, post_view_conversions, total_conversions, post_click_revenue, post_view_revenue, total_revenue, total_ad_cost"
 },
 "Cookies": "[@Credentials.Auth.@~Cookies]",
 "ResponseFormat":"Csv",
 "CvsHeader":"true", 
 "DataPath": ""
 },
 
 {
 "Name": "Geo Report - Single Advertiser",
 "Public": "True",
 "Schema": "Https",
 "Method": "GET",
 "Base": "[@Settings.Parameters.uri]",
 "Path": "reporting/v1/std/geo",
 "Headers": {},
 "PathParameters": [],
 "QueryParameters": {
 "api_key":"[@Settings.Parameters.api_key]",
 "start_date": "2014-03-01",
 "time_rollup": "by_day",
 "dimensions": "campaign_name, campaign_id, advertiser_name, campaign_goal_type, strategy_channel, strategy_goal_type, strategy_name, strategy_type, metro_name, region_code, region_name, country_code, country_name", 
 "having": "advertiser_id=[@Settings.Parameters.advertiser_id]",
 "metrics": "impressions, clicks, total_spend, post_click_conversions, post_view_conversions, total_conversions, total_ad_cost"
 },
 "Cookies": "[@Credentials.Auth.@~Cookies]",
 "ResponseFormat":"Csv",
 "CvsHeader":"true", 
 "DataPath": ""
 }
 
 ]

The QueryParameters contains most of what you'll need to change (again, see MediaMath's documentation for reference) to add new dimensions or metrics, change the granularity ("having" parameter) from a single advertiser to an entire organization_id for example, or change the timeframe of the pull, etc.  
To add a new table, copy one of the existing ones (including both curly brackets) and change the parameters as needed.  Tables must be coma separated.  

ADDITIONAL NOTES

Modification of this connector is intended for those with experience with web development & REST APIs.  Detail & care must be given when pulling from new endpoints or modifying any of these tables.
Rate this article:
Version history
Last update:
‎03-02-2023 08:52 AM
Updated by:
Contributors