cost 数据 Query API

概述

Query API 是一个 HTTP API,可用于通过编程方式查询预聚合的分析。无需访问操作后台 (Dashboard),便可获取与 Branch 操作后台 (Dashboard)中显示的相同数据。

Please refer to the Query API for full reference documentation.

局限性

Limitation

细节

OS (user_data_os) + Country (user_data_geo_country_code)

Querying with OS and Country dimensions will return an error.

Secondary Publisher (last_attributed_touch_data_tilde_secondary_publisher) + Country (user_data_geo_country_code)

Querying with Secondary Publisher and Country will return an error

消耗数据

通过 API 提取 cost 数据的建议用法是“按合作伙伴和 campaign 提取所有 cost”。您可以尝试深入研究诸如关键字和操作系统之类的内容,但是您绝对应该计划处理空值,因为合作伙伴 API 提供的细分在合作伙伴之间是不一致的。如果操作后台 (Dashboard)针对某些成本细分向您返回零值,则 API 也会返回零。

👍

重要提示

  • Aggregation must be cost or cost_in_local_currency (for other dimensions it could be "total_count" or "unique_count" but those are not applicable for cost).

  • If Aggregation is cost, then cost is returned in USD, where the exchange rate is stored at the time we retrieve from an API (virtually always the day of the campaign, e.g. we pull data for a campaign that ran Dec 17th 2020 into the Branch system on Dec 17th 2020 and the exchange rate will be the exchange rate on Dec 17th 2020). If Aggregation is cost_in_local_currency, then cost is returned in the currency associated with cost, when Branch pulled it from an ad network.

  • 我们将仅返回广告合作伙伴API 可用的参数,因此维度通常会以"null"的 cost 显示。例如,快照数据几乎没有设备故障(例如,操作系统)

  • Supported partners: FB, Google, Snap, Apple, TikTok.

  • Cost 数据通常可在合作伙伴 API 中的6-12小时内在 Branch 中获得。

  • Cost 数据可能会随时间变化,因为我们会在今天和更新日期之前30天根据合作伙伴 API 进行准确性检查。

每个广告合作伙伴/Campaign 的 Cost

curl -X POST 'https://api.branch.io/v1/query/analytics' -H 'content-type: application/json' -d '{
  "start_date": "2019-12-06",
  "end_date": "2019-12-11",
  "branch_key": "<branch_live_key>",
  "branch_secret": "<secret_key>,
  "data_source": "cost",
  "enable_install_recalculation": true,
  "dimensions": [
    "last_attributed_touch_data_tilde_advertising_partner_name",
    "last_attributed_touch_data_tilde_campaign"
  ],                      
  "ordered": "descending",
  "aggregation": "cost"
}'

结果示例:

{
  "results" : [ {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "fb_zeit",
      "cost" : 23636.767182316362,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Facebook"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "google_zeit",
      "cost" : 12475.522455796843,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Google AdWords"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName8",
      "cost" : 202.59,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName1",
      "cost" : 158.07999999999998,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName2",
      "cost" : 158.14,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName0",
      "cost" : 100.65,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName7",
      "cost" : 98.57,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName5",
      "cost" : 98.21000000000001,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName6",
      "cost" : 96.42,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName3",
      "cost" : 55.13,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  }, {
    "timestamp" : "2019-12-01T00:00:00.000-08:00",
    "result" : {
      "last_attributed_touch_data_tilde_campaign" : "CampaignName4",
      "cost" : 53.57,
      "last_attributed_touch_data_tilde_advertising_partner_name" : "Apple Search Ads"
    }
  } ],
  "paging" : {
    "total_count" : 11
  }
}