使用Google Analytics导出API获取网站趋势 [英] Using the Google Analytics Export API to get a websites trend

查看:116
本文介绍了使用Google Analytics导出API获取网站趋势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究使用Google Analytics导出API的应用程序,并试图获得Google针对每个网站帐户以百分比形式显示的趋势结果



即UP 35.04%或DOWN 16.02%

它们如何/在哪里得到这个数字,并且可以在API中找到。



我试着比较上个月的平均值与期间的本月/第一周和期间的上周等,但我似乎无法获得Google提供的相同数字。



有什么想法?



预先感谢
道格

解决方案

这个公式非常简单(不包括今天的数据):


过去30天 - 在31至60天前访问
)/(在31至60天前访问
)。

如果您转到默认仪表板,那么它可以在界面中看到它向您发放最近30天,然后在日历上点击与过去相比并选择默认金额。它会显示每个计算所用的数字以及它们在该帐户列表中显示的计算结果。然而,API不公开预先计算的数字(例如,它们不会为您计算跳出率;它们只是给您提供的部分)



所以,你需要做两个API请求来获取这些数据。一个用于 ga:访问过去30天,然后一个用于 ga:访问在前30天。



然后,当你得到它时,只需减去,除以乘以100即可得到你想要的百分比。 b
$ b

更新:答案的提出部分是真实的,但不再是。 Google Analytics API的最新版本确实提供了一些访问权限预先计算的值。


i am working on an application that uses the Google Analytics Export API and i am trying to get the "Trend" result that Google shows against each of your site accounts as a percentage

ie UP 35.04% or DOWN 16.02%

How/where do they get this figure and is it available in the API somewhere.

i have tried comparing averages of last month to this month/first week of the period vs last week of the period etc, but i cannot seem to get the same numbers that Google provides.

any ideas?

thanks in advance Doug

解决方案

The formula is pretty simple (excluding today's data):

(Visits over the last 30 days - Visits between 31 and 60 days ago) / (Visits between 31 and and 60 days ago).

You can see it in action in the interface if you go to the default dashboard, where it shows you the last 30 days, then on the calendar, click "Compare to past" and select the default amount. It'll show you the numbers used for each calculation and the calculations as they appears in that account list.

The API does not, however, expose pre-calculated numbers (for example, they don't compute bounce rate for you; they just give you the pieces for it.)

So, you'd need to do two API requests to get this data. One for ga:visits in the last 30 days, and then one for ga:visits in the 30 days prior.

Then, when you get it, just subtract, divide, and multiply by 100, and you'll have the percent you're looking for.

UPDATE: The striked out part of the answer was true, but is no longer. The newest version of the Google Analytics API does provide access to some pre-calculated values.

这篇关于使用Google Analytics导出API获取网站趋势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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