@socialgouv/matomo-postgres 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@socialgouv/matomo-postgres",
3
3
  "description": "Extract visitor events from Matomo API and push to Postgres",
4
- "version": "1.4.1",
4
+ "version": "1.5.0",
5
5
  "types": "types/index.d.ts",
6
6
  "license": "Apache-2.0",
7
7
  "main": "src/index.js",
@@ -21,8 +21,8 @@ Array [
21
21
  ],
22
22
  Array [
23
23
  "insert into matomo
24
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
25
- values ($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)
24
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
25
+ values ($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)
26
26
  ON CONFLICT DO NOTHING",
27
27
  Array [
28
28
  "42",
@@ -37,6 +37,9 @@ Array [
37
37
  "300",
38
38
  "23",
39
39
  "returningCustomer",
40
+ "visitorId",
41
+ "referrerType",
42
+ "referrerName",
40
43
  "tests",
41
44
  "24",
42
45
  "2021-08-20T21:55:12.000Z",
@@ -81,8 +84,8 @@ Array [
81
84
  ],
82
85
  Array [
83
86
  "insert into matomo
84
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
85
- values ($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)
87
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
88
+ values ($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)
86
89
  ON CONFLICT DO NOTHING",
87
90
  Array [
88
91
  "42",
@@ -97,6 +100,9 @@ Array [
97
100
  "300",
98
101
  "23",
99
102
  "returningCustomer",
103
+ "visitorId",
104
+ "referrerType",
105
+ "referrerName",
100
106
  "tests",
101
107
  "24",
102
108
  "2021-08-20T21:55:12.000Z",
@@ -138,8 +144,8 @@ Array [
138
144
  ],
139
145
  Array [
140
146
  "insert into matomo
141
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
142
- values ($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)
147
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
148
+ values ($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)
143
149
  ON CONFLICT DO NOTHING",
144
150
  Array [
145
151
  "42",
@@ -154,6 +160,9 @@ Array [
154
160
  "300",
155
161
  "23",
156
162
  "returningCustomer",
163
+ "visitorId",
164
+ "referrerType",
165
+ "referrerName",
157
166
  "tests",
158
167
  "24",
159
168
  "2021-08-20T21:55:12.000Z",
@@ -195,8 +204,8 @@ Array [
195
204
  ],
196
205
  Array [
197
206
  "insert into matomo
198
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
199
- values ($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)
207
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
208
+ values ($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)
200
209
  ON CONFLICT DO NOTHING",
201
210
  Array [
202
211
  "42",
@@ -211,6 +220,9 @@ Array [
211
220
  "300",
212
221
  "23",
213
222
  "returningCustomer",
223
+ "visitorId",
224
+ "referrerType",
225
+ "referrerName",
214
226
  "tests",
215
227
  "24",
216
228
  "2021-08-20T21:55:12.000Z",
@@ -255,8 +267,8 @@ Array [
255
267
  ],
256
268
  Array [
257
269
  "insert into matomo
258
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
259
- values ($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)
270
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
271
+ values ($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)
260
272
  ON CONFLICT DO NOTHING",
261
273
  Array [
262
274
  "42",
@@ -271,6 +283,9 @@ Array [
271
283
  "300",
272
284
  "23",
273
285
  "returningCustomer",
286
+ "visitorId",
287
+ "referrerType",
288
+ "referrerName",
274
289
  "tests",
275
290
  "24",
276
291
  "2021-08-20T21:55:12.000Z",
@@ -312,8 +327,8 @@ Array [
312
327
  ],
313
328
  Array [
314
329
  "insert into matomo
315
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
316
- values ($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)
330
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
331
+ values ($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)
317
332
  ON CONFLICT DO NOTHING",
318
333
  Array [
319
334
  "42",
@@ -328,6 +343,9 @@ Array [
328
343
  "300",
329
344
  "23",
330
345
  "returningCustomer",
346
+ "visitorId",
347
+ "referrerType",
348
+ "referrerName",
331
349
  "tests",
332
350
  "24",
333
351
  "2021-08-20T21:55:12.000Z",
@@ -32,6 +32,8 @@ Array [
32
32
  "idsite": "42",
33
33
  "idvisit": "124",
34
34
  "operatingsystemname": "Mac",
35
+ "referrername": "referrerName",
36
+ "referrertype": "referrerType",
35
37
  "region": "Buenos Aires",
36
38
  "serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
37
39
  "siteSearchKeyword": undefined,
@@ -54,6 +56,7 @@ Array [
54
56
  },
55
57
  "userid": "24",
56
58
  "visitduration": "300",
59
+ "visitorid": "visitorId",
57
60
  "visitortype": "returningCustomer",
58
61
  },
59
62
  Object {
@@ -86,6 +89,8 @@ Array [
86
89
  "idsite": "42",
87
90
  "idvisit": "124",
88
91
  "operatingsystemname": "Mac",
92
+ "referrername": "referrerName",
93
+ "referrertype": "referrerType",
89
94
  "region": "Buenos Aires",
90
95
  "serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
91
96
  "siteSearchKeyword": undefined,
@@ -105,6 +110,7 @@ Array [
105
110
  "usercustomproperties": Object {},
106
111
  "userid": "24",
107
112
  "visitduration": "300",
113
+ "visitorid": "visitorId",
108
114
  "visitortype": "returningCustomer",
109
115
  },
110
116
  Object {
@@ -137,6 +143,8 @@ Array [
137
143
  "idsite": "42",
138
144
  "idvisit": "124",
139
145
  "operatingsystemname": "Mac",
146
+ "referrername": "referrerName",
147
+ "referrertype": "referrerType",
140
148
  "region": "Buenos Aires",
141
149
  "serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
142
150
  "siteSearchKeyword": "scuba",
@@ -156,6 +164,7 @@ Array [
156
164
  "usercustomproperties": Object {},
157
165
  "userid": "24",
158
166
  "visitduration": "300",
167
+ "visitorid": "visitorId",
159
168
  "visitortype": "returningCustomer",
160
169
  },
161
170
  ]
@@ -165,8 +174,8 @@ exports[`importEvent: should extract events from matomo visit actionsDetails and
165
174
  Array [
166
175
  Array [
167
176
  "insert into matomo
168
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
169
- values ($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)
177
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
178
+ values ($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)
170
179
  ON CONFLICT DO NOTHING",
171
180
  Array [
172
181
  "42",
@@ -181,6 +190,9 @@ Array [
181
190
  "300",
182
191
  "23",
183
192
  "returningCustomer",
193
+ "visitorId",
194
+ "referrerType",
195
+ "referrerName",
184
196
  "tests",
185
197
  "24",
186
198
  "2021-08-20T21:55:12.000Z",
@@ -225,8 +237,8 @@ Array [
225
237
  ],
226
238
  Array [
227
239
  "insert into matomo
228
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
229
- values ($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)
240
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
241
+ values ($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)
230
242
  ON CONFLICT DO NOTHING",
231
243
  Array [
232
244
  "42",
@@ -241,6 +253,9 @@ Array [
241
253
  "300",
242
254
  "23",
243
255
  "returningCustomer",
256
+ "visitorId",
257
+ "referrerType",
258
+ "referrerName",
244
259
  "tests",
245
260
  "24",
246
261
  "2021-08-20T21:55:12.000Z",
@@ -282,8 +297,8 @@ Array [
282
297
  ],
283
298
  Array [
284
299
  "insert into matomo
285
- (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
286
- values ($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)
300
+ (idsite, idvisit, actions, country, region, city, operatingsystemname, devicemodel, devicebrand, visitduration, dayssincefirstvisit, visitortype, visitorid, referrertype, referrername, sitename, userid, serverdateprettyfirstaction, action_id, action_type, action_title, action_eventcategory, action_eventaction, action_eventname, action_eventvalue, action_timespent, action_timestamp, action_url, siteSearchKeyword, usercustomproperties, usercustomdimensions, dimension1, dimension2, dimension3, dimension4, dimension5, dimension6, dimension7, dimension8, dimension9, dimension10)
301
+ values ($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)
287
302
  ON CONFLICT DO NOTHING",
288
303
  Array [
289
304
  "42",
@@ -298,6 +313,9 @@ Array [
298
313
  "300",
299
314
  "23",
300
315
  "returningCustomer",
316
+ "visitorId",
317
+ "referrerType",
318
+ "referrerName",
301
319
  "tests",
302
320
  "24",
303
321
  "2021-08-20T21:55:12.000Z",
@@ -45,7 +45,10 @@ CREATE TABLE IF NOT EXISTS matomo
45
45
  dimension10 text,
46
46
  action_url text,
47
47
  sitesearchkeyword text,
48
- action_title text
48
+ action_title text,
49
+ visitorid text,
50
+ referrertype text,
51
+ referrername text
49
52
  ) PARTITION BY RANGE (action_timestamp);
50
53
  ",
51
54
  Array [],
@@ -12,7 +12,7 @@ const matomoVisit = require("./visit.json");
12
12
 
13
13
  const run = require("../index");
14
14
 
15
- const NB_REQUEST_TO_INIT_DB = 1; // Number of query to init DB (createTable.js)
15
+ const NB_REQUEST_TO_INIT_DB = 3; // Number of query to init DB (createTable.js)
16
16
  const TEST_DATE = new Date();
17
17
 
18
18
  // @ts-ignore
@@ -9,6 +9,9 @@
9
9
  "daysSinceFirstVisit": "23",
10
10
  "actions": "2",
11
11
  "visitorType": "returningCustomer",
12
+ "visitorId": "visitorId",
13
+ "referrerType": "referrerType",
14
+ "referrerName": "referrerName",
12
15
  "siteName": "tests",
13
16
  "userId": "24",
14
17
  "region": "Buenos Aires",
@@ -51,13 +51,29 @@ CREATE TABLE IF NOT EXISTS ${table}
51
51
  dimension10 text,
52
52
  action_url text,
53
53
  sitesearchkeyword text,
54
- action_title text
54
+ action_title text,
55
+ visitorid text,
56
+ referrertype text,
57
+ referrername text
55
58
  ) PARTITION BY RANGE (action_timestamp);
56
59
  `;
57
60
 
58
61
  await client.query(text, []);
59
62
 
60
- const migrations = [];
63
+ const migrations = [
64
+ `CREATE INDEX IF NOT EXISTS idx_dimension1 ON matomo(dimension1);
65
+ CREATE INDEX IF NOT EXISTS idx_dimension2 ON matomo(dimension2);
66
+ CREATE INDEX IF NOT EXISTS idx_dimension3 ON matomo(dimension3);
67
+ CREATE INDEX IF NOT EXISTS idx_dimension4 ON matomo(dimension4);
68
+ CREATE INDEX IF NOT EXISTS idx_dimension5 ON matomo(dimension5);
69
+ CREATE INDEX IF NOT EXISTS idx_userid ON matomo(userid);
70
+ CREATE INDEX IF NOT EXISTS idx_actionurl ON matomo(action_url);
71
+ CREATE INDEX IF NOT EXISTS idx_region ON matomo(region);`,
72
+ `ALTER TABLE matomo ADD COLUMN IF NOT EXISTS visitorid text;
73
+ ALTER TABLE matomo ADD COLUMN IF NOT EXISTS referrertype text;
74
+ ALTER TABLE matomo ADD COLUMN IF NOT EXISTS referrername text;
75
+ CREATE INDEX IF NOT EXISTS idx_visitorid ON matomo(visitorid);`,
76
+ ];
61
77
 
62
78
  for (const query of migrations) {
63
79
  await client.query(query, []);
@@ -35,6 +35,9 @@ const matomoProps = [
35
35
  "visitDuration",
36
36
  "daysSinceFirstVisit",
37
37
  "visitorType",
38
+ "visitorId",
39
+ "referrerType",
40
+ "referrerName",
38
41
  "siteName",
39
42
  "userId",
40
43
  ];
@@ -93,7 +96,7 @@ const getEventsFromMatomoVisit = (matomoVisit) => {
93
96
  // custom variables
94
97
  usercustomproperties,
95
98
  // custom dimensions
96
- // We keep both for backwards compatibility.
99
+ // We keep both for backwards compatibility.
97
100
  // Current implementation is flat with one column for each dimension.
98
101
  usercustomdimensions,
99
102
  ...usercustomdimensions,