在Google Analytics JavaScript API上查询多个ID [英] Query multiple ID's on Google Analytics Javascript API

查看:95
本文介绍了在Google Analytics JavaScript API上查询多个ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Analytic API for javascript。

我正在执行用户对数据范围计数的查询,并将视图ID传递给query:

  gapi.client.analytics.data.ga.get({
'ids':'ga: XXXXXXXX',
'start-date':'2014-10-01',
'end-date':'2014-10-15',
'metrics':'ga: (results.rows&&& results.rows.length)
console.log(results.rows [0] [])用户的
})。 0]);
});

然而,由于我正在处理使用的配额,并且我需要查询多个视图。

是否可以在同一个查询中为多个id申请报表?



类似于:

  gapi.client.analytics.data.ga.get({
'ids':'ga:XXXXXXXX,ga:XXXXXXXXX,ga:XXXXXXXXXX',//显然不行的


答案:没有办法请求更多的个人资料ID



Google Analtyics Reporting API 解决方案

href =https://developers.google.com/analytics/devguides/reporting/core/v3/reference#ids =nofollow>参考资料


ids = ga:12345
格式为ga:XXXX的唯一表格ID,其中XXXX是查询将检索的Analytics
视图(配置文件)ID数据。


即使它是calle d IDS并不意味着你可以发送更多的信息。你不能只能一次发送一个。这是您必须多次运行您的请求的独特价值。如果你仔细想一想,这是有道理的,因为你将得到的数据会混合在不同的配置文件ID之间,所以你无法分辨数据来自哪个配置文件,因为配置文件不是维度。

I'm using Google Analytic's API for javascript.

I'm performing a query for the user's count of a data range, and passing the view ID to the query:

gapi.client.analytics.data.ga.get({
    'ids': 'ga:XXXXXXXX',
    'start-date': '2014-10-01',
    'end-date': '2014-10-15',
    'metrics': 'ga:users'
}).execute(function (results) {
    if (results.rows && results.rows.length)
        console.log(results.rows[0][0]);
});

However, since I'm dealing with the quotas of usage, and I needed to query for multiple views.

Is there a way to request the report for more than one id in the same query?

Something like:

 gapi.client.analytics.data.ga.get({
    'ids': 'ga:XXXXXXXX, ga:XXXXXXXXX, ga:XXXXXXXXXX', //Which obviously doesn't work

解决方案

Answer: No there is no way to request more then one profile id

Google Analtyics Reporting API reference

ids=ga:12345 The unique table ID of the form ga:XXXX, where XXXX is the Analytics view (profile) ID for which the query will retrieve the data.

Even though it is called IDS does not mean that you can send more then one. You can't you can only send one at a time. It is a unique value you are going to have to run your request several times. If you think about it this makes sense as the data you would be getting back would be mixed up between the different profile id's you wouldn't be able to tell which profile the data came from as profile is not a dimension.

这篇关于在Google Analytics JavaScript API上查询多个ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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