Adobe Analytics 2.0 API端点,用于获取报告套件事件,道具和evar [英] Adobe Analytics 2.0 API endpoint to get report suite events, props, and evars

查看:132
本文介绍了Adobe Analytics 2.0 API端点,用于获取报告套件事件,道具和evar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在2.0 API中找到一种方法,可以获取给定报告套件的Evars,Props和Events列表。 1.4版本具有 reportSuite.getEvents()端点,并且与Evars和Props类似。

I'm having a hard time finding a way in the 2.0 API that I can get a list of Evars, Props and Events for a given report suite. The 1.4 version has the reportSuite.getEvents() endpoint and similar for Evars and Props.

请告诉我是否有使用2.0 API端点获取相同数据的方法。

Please let me know if there is a way to get the same data using the 2.0 API endpoints.

推荐答案

API v2.0 github docs aren没什么用,但是 Swagger UI 会有所帮助,显示可以推送到它们的端点和参数,并且可以与它们进行交互(使用oauth凭据登录)并查看请求/响应。

The API v2.0 github docs aren't terribly useful, but the Swagger UI is a bit more helpful, showing endpoints and parameters you can push to them, and you can interact with it (logging in with your oauth creds) and see requests/responses.

您特别想要的两个API端点是指标维度。您可以指定许多选项,但是要获得所有这些选项的转储,这些选项的完整端点URL为:

The two API endpoints in particular you want are metrics and dimensions. There are a number of options you can specify, but to just get a dump of them all, the full endpoint URL for those would be:

https://analytics.adobe.io/api/ [客户端ID] / [端点]?rsid = [报告套件ID]

位置:

[客户ID] -您公司的客户ID。此应该与旧版 username:companyid companyid 部分)的值相同来自v1.3 / v1.4的API共享机密凭据,但后缀为 0,例如如果您以前的 username:companyid 是 crayonviolent:foocompany,则 [客户ID] 将是 foocompany0,因为..原因?我不确定这是怎么回事,但事实就是如此。

[client id] - The client id for your company. This should be the same value as the legacy username:companyid (the companyid part) from v1.3/v1.4 API shared secret credentials, with the exception that it is suffixed with "0", e.g. if your old username:companyid was "crayonviolent:foocompany", the [client id] would be "foocompany0", because..reasons? I'm not sure what that's about, but it is what it is.

[端点] -值应该是获取事件的指标,和尺寸来获取道具和电子战车。因此,您将需要发出2个API端点请求。

[endpoint] - Value should be "metrics" to get the events, and dimensions to get the props and eVars. So you will need to make 2 API endpoint requests.

[rsid] -您想要获取的报表套件ID

[rsid] - The report suite id you want to get the list of events/props/eVars from.

示例:

https://analytics.adobe.io/api/foocompany0/metrics?rsid=fooglobal

关于响应的一件事:它们与v1.3或v1.4方法不同,在其中仅查询那些特定内容的列表。它将为每个事件和维度分别返回对象的json数组,甚至包括本机事件,计算的指标,给定维度的分类等。AFAIK没有烘焙API过滤的方式(在任何文档中,仍然可以找到。.),因此您将不得不遍历数组并自己选择相关数组。

One thing to note about the responses: they aren't like the v1.3 or v1.4 methods where you query for a list of only those specific things. It will return a json array of objects for every single event and dimension respectively, even the native ones, calculated metrics, classifications for a given dimension, etc. AFAIK there is no baked in way to filter the API query (that's in any documentation I can find, anyways..), so you will have to loop through the array and select the relevant ones yourself.

我不知道您使用的是哪种语言,但是下面是我基本执行的javascript示例:

I don't know what language you are using, but here is a javascript example for what I basically do:

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 ,每个数组分别包含各自的道具/逃犯/事件。

And then the result data object will have data.prop,data.evar, and data.events, each an array of the respective props/evars/events.

data.events [n] 的示例对象条目:

Example object entry for an 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] 的示例对象条目:

Example object entry for an 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] 的示例对象条目:

Example object entry for a 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
}

这篇关于Adobe Analytics 2.0 API端点,用于获取报告套件事件,道具和evar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆