Export Google Analytics data (event log)
I have several apps and a website that fires Google Analytics events. I would like to export Google Analytics events to my data warehouse in order to have deeper understanding and analytics.
For this question, you can use the language you want (python, ruby, java, etc.).
I'm not an expert in Google Analytics, I don't know how possible this is, but can I get a log of all the events that were triggered? It will look like this:
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, can 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 this is not possible, what is the closest thing to the event log I can get? (I know "close to" is vague ...) I mean, Google Analytics tends to aggregate things, and I would rather not have aggregates ...
As for the first part, the second part from the query result inserts it into the data store, but this is not a problem.
Note (EDIT): In this question, the "quota" aspect (the Google Analytics API limits the number of daily requests) might be skipped the first time. By this I mean, is it possible to get the data in the format that I want, if so, then we can ask ourselves how to do it efficiently given the constraints
Thanks in advance!
source to share
Google Analytics does not provide you with any data containing id
With your Google Analytics Premium part you get a complete table of all the information you want about fullVisitorId
and visitId
(sessionId)
The large query export schema contains details of the data you may have
There is a way to do this without leaving Google Analytics premium service
Decision. If you don't want the data to be aggregated, add dimensions of your choice to segment the data. In this case user_id
andevent_id
Approach to
In Google Analytics, the Event Report is what you can use,
Event Category
: send user_id generated by your JS code
Event Action
: send event_id generated again by your JS code
Event Label
: foo
Date
this is the default available in Google Analytics
Approach of two
Custom Dimesnion
: send user_id generated by your JS code
Event Category
: send event_id generated by your JS code
Event Action
: foo
Date
this is the default available in Google Analytics
The advantage of using the second approach is that after you set up a custom dimension with, user_id
you can use it in most reports other than event reporting.
Data can be retrieved from Google Analytics using the Core Reporting API
source to share