Using the Funnel API you can get all ad platform and Google Analytics data in your Funnel Account broken down by day and two other Dimensions. Which Dimensions to segment by and which currency to use can be configured. 

Prerequisites 

Before you can start using the API you need to 

  • Connect data sources to Funnel
  • Make sure you have data grouped into Dimensions
  • Have the API feature enabled for your account 
  • Create an API Token for your Funnel account
  • Create an API Project for your Funnel account

Request

The API calls are HTTP GET requests for JSON data. The format of the URL is:

https://api.funnel.io/api/account/v1/$ACCOUNT_ID/project/$PROJECT_ID
    ?group_by=$GROUP_BY
    &start_day=$START_DAY&end_day=$END_DAY
    &fields=$FIELDS
    &apiToken=$API_TOKEN

Newlines and indentation are for readability, it is one long URL string. Each $ parameter is detailed below:

$ACCOUNT_ID (required)
Your Funnel Account ID, this is listed in the API Export page.

$PROJECT_ID (required)
Your Funnel API Project ID. This is an API key that identifies which dimension and currency to get data for.

$GROUP_BY (required)

  • day: values will be grouped by day and the Dimension that you selected under the ”channel” dropdown when setting up your API project. 
  • campaign_day: values will be grouped by day, the Dimension that you selected under the ”channel” dropdown as well as the Dimension selected under the ”campaign” dropdown. 

$START_DAY (optional)
The first date in the range of dates to include in the result, on the format YYYY-MM-DD  such as "2017-01-01".  Defaults to 90 days ago. Must be before end_day .

$END_DAY (optional)
The last date in the range of dates to include in the result, on the format YYYY-MM-DD such as "2017-01-31". Defaults to today. Must be after start_day .

$FIELDS (optional)

A list of metrics to include in the results, the IDs should be separated by comma (URL-encoded as %2C) e.g. common-cost%2Cga-sessions .  Defaults to common-cost, common-clicks, ga-sessions, ga-transactions .

Which fields / metrics are supported in your account are listed on the API Export page. You can also find a list of supported metrics here.

Please note that derived metrics (such as CTR) and custom metrics that you have defined using your own formulas are not available in the API. 

Cost, clicks and impressions are defined as common metrics which means that you don't need to get one specific metric per ad platform. If you add common-cost, common-clicks and common-impressions in your request these will be broken down by dimension in the response. 

$API_TOKEN (required)
Each Funnel Account may have a unique API_TOKEN. This is shown under the Export > API page. Please contact support if you do not have access to this view. 

Response

The response from the API is a JSON that has some metadata and then an array with JSON objects per ”channel-dimension” (the dimension you chose under the channel dropdown), day and optionally campaign-dimension  (the dimension you chose under the campaign dropdown). Each object has name/value pairs for each metric field.

Note that monetary values are encoded as 1000 * the base unit of currency. E.g 12.34 USD will be encoded as 12340.

The format of the JSON is:

{
  "accountName": "ACCOUNT NAME",
  "currency": "USD",
  "id": "PROJECT_ID",
  "name": "DIMENSION_NAME",
  "per_day": [
    {
      "day": "2015-10-01",
      "channel": "DIMENSION VALUE A",
      "campaign": "DIMENSION VALUE X",
      "common-cost": 153430,
      "ga-sessions": 375
    },
    {
      "day": "2015-10-01",
      "channel": "DIMENSION VALUE B",
      "campaign": "DIMENSION VALUE Y",
      "common-cost": 5078710,
      "ga-sessions": 5514
    },
    {
      "day": "2015-10-02",
      "channel": "DIMENSION VALUE A",
      "campaign": "DIMENSION VALUE X",
      "common-cost": 2051030,
      "ga-sessions": 2136
    },
    {
      "day": "2015-10-02",
      "channel": "DIMENSION VALUE B",
      "campaign": "DIMENSION VALUE Y",
      "common-cost": null,
      "ga-sessions": 503
    }
  ]
}
Did this answer your question?