我很难在2.0 API中找到一种方法,可以为给定的报告套件获取Evars,Props和Events的列表。 1.4版本具有reportSuite.getEvents()端点,与Evars和Props类似。
[请让我知道是否有一种使用2.0 API端点获取相同数据的方法。
API v2.0 github文档并不是非常有用,但是Swagger UI更有帮助,它显示了可以推送到它们的端点和参数,并且可以与之交互(使用oauth凭据登录)和请参阅请求/响应。
您特别想要的两个API端点是metrics
和dimensions
。您可以指定许多选项,但是要获得所有这些选项的转储,这些选项的完整端点URL将是:
https://analytics.adobe.io/api/[client id]/[endpoint]?rsid=[report suite id]
其中:
[client id]
-您公司的客户ID。此应该与v1.3 / v1.4 API共享机密凭据的旧版username:companyid
(companyid
部分)相同,但其后缀为“ 0”,例如。如果您以前的username:companyid
是“ crayonviolent:foocompany”,则[client id]
将是“ foocompany0”,因为。原因?我不确定这是什么,但这是事实。
[[endpoint]
-值应为“度量”以获取事件,值为dimensions
以获取道具和eVar。因此,您将需要发出2个API端点请求。
[[rsid]
-您要从中获取事件/道具/电子战清单的报告套件ID。
示例:
https://analytics.adobe.io/api/foocompany0/metrics?rsid=fooglobal
关于响应要注意的一件事:它们与v1.3或v1.4方法不同,在这些方法中,您仅查询那些特定内容的列表。它将为每个事件和维度分别返回对象的json数组,甚至包括本机事件,计算的指标,给定维度的分类等。AFAIK没有烘焙API过滤的方式(在任何文档中,仍然可以找到。.),因此您将不得不遍历数组并自己选择相关数组。
我不知道您使用的是哪种语言,但是下面是我基本执行的JavaScript示例:
var i, l, v, data = { prop:[], evar: [], events:[] };
// dimensionsList - the JSON object returned from dimensions API call
// for each dimension in the list..
for (i=0,l=dimensionsList.length;i<l;i++) {
// The .id property shows the dimension id to eval
if ( dimensionsList[i].id ) {
// the ones we care about are e.g. "variables/prop1" or "variables/evar1"
// note that if you have classifications on a prop or eVar, there are entries
// that look like e.g. "variables/prop1.1" so regex is written to ignore those
v = (''+dimensionsList[i].id).match(/^variables\/(prop|evar)[0-9]+$/);
// if id matches what we're looking for, push it to our data.prop or data.evar array
v && v[1] && data[v[1]].push(dimensionsList[i]);
}
}
// metricsList - the JSON object returned from metrics API call
// basically same song and dance as above, but for events.
for (var i=0,l=metricsList.length;i<l;i++) {
if ( metricsList[i].id ) {
// events ids look like e.g. "metrics/event1"
var v = (''+metricsList[i].id).match(/^metrics\/event[0-9]+$/);
v && data.events.push(metricsList[i]);
}
}
然后结果data
对象将具有data.prop
,data.evar
和data.events
,每个都是各自的道具/逃避/事件的数组。
data.events[n]
的示例对象条目:
{
"id": "metrics/event1",
"title": "(e1) Some event",
"name": "(e1) Some event",
"type": "int",
"extraTitleInfo": "event1",
"category": "Conversion",
"support": ["oberon", "dataWarehouse"],
"allocation": true,
"precision": 0,
"calculated": false,
"segmentable": true,
"supportsDataGovernance": true,
"polarity": "positive"
}
data.evar[n]
的示例对象条目:
{
"id": "variables/evar1",
"title": "(v1) Some eVar",
"name": "(v1) Some eVar",
"type": "string",
"category": "Conversion",
"support": ["oberon", "dataWarehouse"],
"pathable": false,
"extraTitleInfo": "evar1",
"segmentable": true,
"reportable": ["oberon"],
"supportsDataGovernance": true
}
data.prop[n]
的示例对象条目:
{
"id": "variables/prop1",
"title": "(c1) Some prop",
"name": "(c1) Some prop",
"type": "string",
"category": "Content",
"support": ["oberon", "dataWarehouse"],
"pathable": true,
"extraTitleInfo": "prop1",
"segmentable": true,
"reportable": ["oberon"],
"supportsDataGovernance": true
}