简体   繁体   English

导出Google Analytics数据(事件日志)

[英]Export Google Analytics data (log of events)

I have some applications and a website that trigger Google Analytics events. 我有一些应用程序和一个触发Google Analytics事件的网站。 I would like to export google analytics events to my datawarehouse in order to have better insights and analytics. 我想将谷歌分析事件导出到我的数据仓库,以获得更好的见解和分析。

For this question, you can use the language you want (python, ruby, java, etc.). 对于这个问题,你可以使用你想要的语言(python,ruby,java等)。

I'm not an expert in Google Analytics, I don't know if it's feasible, but can I get a log of all events that were triggered ? 我不是谷歌分析方面的专家,我不知道它是否可行,但我可以获得所有触发事件的日志吗? It would look like that : 看起来像这样:

   event_id    |   user_id    |   date     |      foo
   ----------------------------------------------------
        210    |    1245076   | 07-08-2015 |   bla
        211    |      124     | 07-08-2015 |   bla2
        214    |    1245081   | 07-08-2015 |   bla3
        215    |     48789    | 07-09-2015 |   last line

If not, could I at least get it by session ? 如果没有,我至少可以通过会话获得它吗? Like this : 像这样 :

   session_id  |   user_id    |   date     |      foo
   ----------------------------------------------------
        210    |    1245076   | 07-08-2015 |   bla
        211    |      124     | 07-08-2015 |   bla2
        214    |    1245081   | 07-08-2015 |   bla3
        215    |     48789    | 07-09-2015 |   last line

If it is not possible, what are the closest things to a log of event I can get ? 如果不可能的话,我能得到的事件记录最接近的是什么? (I know "close to" is vague ...) I mean, google analytics tends to aggregate things, and I would prefer not to have aggregates ... (我知道“接近”是模糊的...)我的意思是,谷歌分析倾向于聚合事物,我宁愿没有聚合......

That's the first part, then the second part is from the result of a query insert it into the datawarehouse, but it is not the problematic part. 这是第一部分,然后第二部分是从查询结果插入数据仓库,但它不是问题部分。

Note (EDIT) : in this question, the "quota" aspect (Google Analytics API limits the number of daily requests) can be ommited in a first time. 注意(编辑):在这个问题中,可以在第一时间省略“配额”方面(Google AnalyticsAPI限制每日请求的数量)。 By that I mean, is it possible to get data in the format I want, if yes then we can ask ourselves how to do that efficiently given the limitations 我的意思是,是否有可能以我想要的格式获取数据,如果是,那么我们可以问自己如何有效地实现这一点

Thanks in advance ! 提前致谢 !

Google Analytics doesn't provide you with any data that contains id Google Analytics不会向您提供包含id任何数据

Its a part of Google Analytics Premium, you get a full table of all the info you want about fullVisitorId and visitId (sessionId) 它是Google Analytics Premium的一部分,您可以获得有关fullVisitorIdvisitId (sessionId)的所有信息的完整表格

Big Query Export Schema has a detailed info about the data you can have Big Query Export Schema有关于您可以拥有的数据的详细信息


There exists a way to do this without going for the premium service of Google Analytics 有一种方法可以在不使用Google Analytics的高级服务的情况下执行此操作

Solution : If you don't want the data to get aggregated add dimensions of your choice to segment the data. 解决方案 :如果您不希望聚合数据,请添加您选择的维度以对数据进行细分。 In this case user_id and event_id 在这种情况下, user_idevent_id

Approach one 方法之一

In Google Analytics Event Report is something you can use, 在Google Analytics中,您可以使用事件报告

Event Category : send the user_id, generated by your JS code Event Category :发送由JS代码生成的user_id

Event Action : send the event_id, again generated by your JS code Event Action :发送由JS代码再次生成的event_id

Event Label : foo Event Label :foo

Date this is a default dimension that is available in Google Analytics Date这是Google Analytics中提供的默认维度

Approach two 方法二

Custom Dimesnion : send the user_id, generated by your JS code Custom Dimesnion :发送由JS代码生成的user_id

Event Category : send the event_id, generated by your JS code Event Category :发送由JS代码生成的event_id

Event Action : foo Event Action :foo

Date this is a default dimension that is available in Google Analytics Date这是Google Analytics中提供的默认维度

There are benefits of using the second approach is that, once you set the custom dimension with a user_id , you can use it most of the reports other than the event report. 使用第二种方法的好处是,一旦使用user_id设置自定义维度,就可以使用除事件报告之外的大多数报告。


Data can be extracted from Google Analytics using Core Reporting API 可以使用Core Reporting API从Google Analytics中提取数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM