Flurry 分析 API 中文教程(Flurry Analytics API)

本文记录使用 API 获取 Flurry Analytics 报告的文档。

包含前期准备、API基础、数据详情、请求示例等

初期准备

  • 获取 App Token
  • header 中必须包含:Authorization: Bearer + App Token
  • Flurry Analytics API Query Builder 查询器、调试器

示例:

Headers:

Authorization: Bearer xxxxxx

API 基础

API 地址https://api-metrics.flurry.com/public/v1/data/

API 请求可以组合起来去查询分析数据的元素。 API 中的所有内容都区分大小写

endPoint/table/timeGrain/dimension1/dimension2;show=all/dimension3{...}?metrics=[comma-separated-metrics]&dateTime=[..]&filters=[...]&topN=[..]&sort=[..]&having=[..]&format=[..]&timeZone=[..]

参数表及示例详见原文。

参数 必要 例子
endpoint v1: https://api-metrics.flurry.com/public/v1/data/
table appUsageappEventeventParamsrealtime
timeGrain 见表详情内容
dimension 见表详情内容
metrics 见表详情内容
dateTime Format for Day, Week: YYYY-MM-DD/YYYY-MM-DD
Format for Month: YYYY-MM/YYYY-MM
Format for Hour: YYYY-MM-DDTHH/YYYY-MM-DDTHH (HH in 24- hour format) follows ISO 8601
filters 组合的一个或多个维度属性过滤器(使用 AND)以减少输出以匹配您的条件。 id和name可用于所有维度。 一些维度具有在维度部分中调用的附加属性。
格式: `dimension1
attribute-operator [ value(s) ], dimension2 attribute-operator [ value(s) ]
运算符:
in, notin, contains, startsWith
例如:
country
name-in [‘United States’,‘Canada’,’Mexico’] ,appVersion name-in[‘2.3’]`
sort 指定一个或多个指标来排序结果。 如果未指定顺序,则默认为降序。
例如: `sort=sessions
desc,activeDevices desc`
topN 减少结果以匹配此参数指定的数字。 如果使用此参数,则还必须使用排序来指示必须计算顶点 n 的度量和顺序
例如:`topN=5 & sort=sessions
desc`
having 减少结果以匹配指定的指标标准。 您可以组合多个指标标准。
格式:metric-operator[value(s)]
可用运算符:等于(eq),大于(gt),小于(lt),而不是版本
例子:sessions-gt[1000],activeDevices-gt[200]
format json (默认), csv
timeZone 默认的结果是UTC时区。 要获取所需时区的结果,请使用此参数。
例如: America/New_YorkAmerica/Los_Angeles

关于时区:https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Analytics Metrics 分析指标

以下是可用于报告的指标。

Metric 指标 描述
sessions 用户访问应用程序的次数
activeDevices 访问应用程序的唯一设备
newDevices 安装并启动应用程序的新设备
timeSpent 用户花在应用程序中的时间
averageTimePerDevice 平均每个用户在应用程序中花费的时间
averageTimePerSession 平均用户在应用程序每个会话中花费的时间

Analytics Dimensions 分析范围、维度

以下是可用于报告的维度和维度属性。

Dimensions范围、维度 描述
company Flurry company account id, name (默认)
app Flurry app id, name (默认), company|id, apiKey, platform|id, platform|name
country 每个国家的维度总计 id, name (默认), iso
appVersion 应用程式的版本号,名称,公司编号,应用程式编号,已删除和筛选。 删除和过滤是布尔值(0或1),并根据开发人员对Flurry开发人员门户的操作反映应用程序版本的当前状态 id, name (默认), company|id, app|id, deleted, filtered
language Language id and name id, name (默认)
region 地区:Region id and name id, name (default)
category 分类: App category id and name id, name (default)
event 仅适用于appEvent表; 事件ID,名称,应用ID,公司ID,删除和过滤。 删除和过滤是布尔值(0或1),并根据开发人员对Flurry开发人员门户的操作反映应用程序事件的当前状态。 id, name (default) , company|id, app|id, deleted, filtered

在运行度量标准查询之前,您需要知道可能的维度值。 例如:您公司帐户上所有应用的列表名称和api密钥:

https://api-metrics.flurry.com/public/v1/data/appUsage/day/company/app;show=name,apiKey?metrics=...

通常,要查看为给定维度返回的默认名称以外的值,请添加:

;show=all
or
;show=id  (any other value listed in the value column above for the given dimension

添加维度名称之后:

https://api-metrics.flurry.com/public/v1/data/appUsage/day/company/country;show=all/category?metrics=sessions,activeDevices,newDevices,timeSpent&dateTime=2017-05-01/2017-05-02

https://api-metrics.flurry.com/public/v1/data/appUsage/day/company/country;show=iso/category?metrics=sessions,activeDevices,newDevices,timeSpent&dateTime=2017-05-01/2017-05-02

App Usage Data 应用使用的数据

Table: appUsage

Metrics 指标 Dimensions 范围 Time Grain
sessions company day
activeDevices app week
newDevices appVersion month
timeSpent country all
averageTimePerDevice language
averageTimePerSession region
medianTimePerSession category

示例:关键应用指标查询

对于所有应用程序,每日会话,每日活动设备,2 天的新设备:请注意,由于过滤器中没有应用信息,结果将包括您公司的所有应用程序。

Request 请求:

https://api-metrics.flurry.com/public/v1/data/appUsage/day/app?metrics=sessions,activeDevices,newDevices&dateTime=2016-07-01/2016-07-03

Response 响应:

{
        "rows": [{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "sessions": 372,
                "activeDevices": 123,
                "newDevices": 32},
        {
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "bar",
                "sessions": 1120,
                "activeDevices": 487,
                "newDevices": 34},
        {
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "sessions": 421,
                "activeDevices": 140,
                "newDevices": 12},
        {
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "bar",
                "sessions": 1164,
                "activeDevices": 453,
                "newDevices": 51}]
}

对于特定应用程序,每月会话,有效设备和新设备(2个月):

Request using Flurry API key:

https://api-metrics.flurry.com/public/v1/data/appUsage/day?metrics=sessions,activeDevices,newDevices&dateTime=2016-06-01/2016-08-01&filters=app|apiKey-in[3WD7Q8329867K7MY6RNS]

Request using App name:

https://api-metrics.flurry.com/public/v1/data/appUsage/day?metrics=sessions,activeDevices,newDevices&dateTime=2016-06-01/2016-08-01&filters=app|name-in[appname]

Response:

{
        "rows": [{
                "dateTime": "2016-06-01 00:00:00.000-07:00",
                "app|name": "foo",
                "sessions": 12744,
                "activeDevices": 6373,
                "newDevices": 6373
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "sessions": 13805,
                "activeDevices": 6882,
                "newDevices": 6882
        }]
}

App Events Data

Table: appEvent

Metrics 指标 Dimensions 范围 Time Grain
activeDevices company day
newDevices app week
eventDuration appVersion month
averageTimePerDevice country all
averageTimePerSession language
medianTimePerSession region
occurrences category
event

示例:关键应用事件指标查询

对于特定应用程序事件,应用程序版本的事件发生次数(2天):

Request:

https://api-metrics.flurry.com/public/v1/data/appEvent/day/app/appVersion/event?metrics=occurrences&dateTime=2016-07-01/2016-07-03&filters=app|name-in[foo],event|name-in[login,register]

Response:

{
        "rows": [{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "occurrences": 293
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "register",
                "occurrences": 57
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "occurrences": 146
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "register",
                "occurrences": 31
        }]
}

对于特定的应用程序事件,按活动设备排序的前5个国家的有效设备和新设备(2天):

Request:

https://api-metrics.flurry.com/public/v1/data/appEvent/day/app/country?metrics=activeDevices,newDevices&dateTime=2016-07-01/2016-07-03&filters=app|name-in[foo],event|name-in[login]&topN=5&sort=activeDevices|desc

Response:

{
        "rows": [{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "United States",
                "occurrences": 515
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "United Kingdom",
                "occurrences": 210
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "Canada",
                "occurrences": 165
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "Germany",
                "occurrences": 87
        },{
                "dateTime": "2016-07-01 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "France",
                "occurrences": 46
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "United States",
                "occurrences": 435
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "United Kingdom",
                "occurrences": 190
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "Canada",
                "occurrences": 127
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "Germany",
                "occurrences": 76
        },{
                "dateTime": "2016-07-02 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "country|name": "France",
                "occurrences": 39
        }]
}

App Event Parameter Data

Table: eventParams

Metrics Dimensions Time Grain
count company day
app week
appVersion month
country all
language
region
category
event
paramName
paramValue

示例:app 事件参数指标查询

对于特定的应用程序事件,提供1天的事件参数值细目:

Request:

https://api-metrics.flurry.com/public/v1/data/eventParams/day/app;show=all/event/paramName/paramValue?metrics=count&filters=app|name-in[foo],event|name-in[level_complete]&dateTime=2016-11-07/2016-11-08

Response:

{
        "rows": [{
                "dateTime": "2016-11-07 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "level_complete",
                "paramName|name": "level",
                "paramValue|name": "1",
                "count": 32
        },{
                "dateTime": "2016-11-07 00:00:00.000-07:00",
                "app|name": "foo",
                "event|name": "login",
                "paramName|name": "level",
                "paramValue|name": "2",
                "count": 15
        }]
}

Real Time App Data 实时数据

Table: realtime (最近 48 小时)

Metrics Dimensions Time Grain
sessions company hour
activeDevices app day
appVersion all
country

示例:实时指标查询,仅限48小时

对于特定应用程序,会话和活动设备在特定时间内:

Request:

https://api-metrics.flurry.com/public/v1/data/realtime/hour?metrics=sessions,activeDevices&dateTime=2016-08-27T12/2016-08-27T13&filters=app|name-in[foo]

Response:

{
        "rows": [{
                "dateTime": "2016-08-31 12:00:00.000-07:00",
                "app|name": "foo",
                "sessions": 145,
                "activeDevices": 90
        }]
}

对于特定应用程序,在特定24小时内(不是日期边界),区分应用程序版本的会话总数和活动设备:

Request:

https://api-metrics.flurry.com/public/v1/data/realtime/all/app/appVersion?metrics=sessions,activeDevices&dateTime=2016-08-31T12/2016-09-01T13&filters=app|name-in[appname]

Response:

{
        "rows": [{
                "dateTime": "2016-08-31 12:00:00.000-07:00",
                "app|name": "foo",
                "appVersion|name": "1.0",
                "sessions": 231,
                "activeDevices": 87
        },{
                "dateTime": "2016-08-31 12:00:00.000-07:00",
                "app|name": "foo",
                "appVersion|name": "1.1",
                "Sessions": 345,
                "activeDevices": 167
        }]
}

Error

详见原文。

官方文档:https://developer.yahoo.com/flurry/docs/api/code/analyticsapi/

如果有什么建议或者问题可以随时联系我,共同探讨学习:

  • Github: likfe
  • CSDN:他叫自己Mr.张
  • 掘金:cafeting
  • 微博:cafeting

你可能感兴趣的:(Flurry 分析 API 中文教程(Flurry Analytics API))