-
Notifications
You must be signed in to change notification settings - Fork 14
/
sample_config.py
125 lines (123 loc) · 5.1 KB
/
sample_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Copy this file to config.py and change the settings
# Project ID and dataset to use in Big query
PROJECT_ID = "my_project"
DATA_SET = "my_ga_data"
GA_BQ_UPLOAD_STATUS_LOG = (DATA_SET+".upload_progress_log")
# View ID of GA. Check your GA view to find it.
VIEW_ID = "12345678"
# First day we upload user_key_email and time so we can request every single log from ga
DATE_INIT = "2016-1-1"
# Tables we want to store from GA
ga_bq_config = {
"user_page_view": {
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:dimension9"}, {"name": "ga:pagePath"}, {"name": "ga:dateHour"}, {"name": "ga:minute"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:timeOnPage"}, {"expression": "ga:exits"}],
"orderBys": [{"fieldName": "ga:dateHour"}, {"fieldName": "ga:minute"}, {"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_page_view"
},
"user_event":{
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:dimension9"}, {"name": "ga:dateHour"}, {"name": "ga:minute"}, {"name": "ga:eventCategory"}, {"name": "ga:eventAction"}, {"name": "ga:eventLabel"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:hits"}],
"orderBys": [{"fieldName": "ga:dateHour"}, {"fieldName": "ga:minute"}, {"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_user_event"
},
"user_device": {
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:deviceCategory"}, {"name": "ga:operatingSystem"}, {"name": "ga:operatingSystemVersion"},
{"name": "ga:browser"}, {"name": "ga:browserVersion"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:timeOnPage"}, {"expression": "ga:pageviews"}],
"orderBys": [{"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_user_device"
},
"user_region": {
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:region"}, {"name": "ga:city"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:timeOnPage"}, {"expression": "ga:pageviews"}],
"orderBys": [{"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_user_region"
},
"user_cookie_map": {
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:dimension10"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:timeOnPage"}, {"expression": "ga:pageviews"}],
"orderBys": [{"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_user_cookie_map"
},
"user_mobile": {
"request_body": {
"reportRequests":
[
{
"viewId": VIEW_ID,
"dateRanges": [{"startDate": "", "endDate": ""}],
"dimensions": [{"name": "ga:dimension8"}, {"name": "ga:mobileDeviceInfo"},
{"name": "ga:operatingSystem"}, {"name": "ga:operatingSystemVersion"},
{"name": "ga:browser"}, {"name": "ga:browserVersion"}],
"dimensionFilterClauses": {},
"metrics": [{"expression": "ga:timeOnPage"}, {"expression": "ga:pageviews"}],
"orderBys": [{"fieldName": "ga:dimension8"}],
"pageSize": "10000",
"pageToken": ""
}
]
},
"destination_table": DATA_SET+".ga_user_mobile"
},
}