Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add visitorid, referrertype, referrername #49

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions src/__tests__/__snapshots__/importDate.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -37,6 +37,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -81,8 +84,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -97,6 +100,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -138,8 +144,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -154,6 +160,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -195,8 +204,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -211,6 +220,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -255,8 +267,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -271,6 +283,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -312,8 +327,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -328,6 +343,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down
30 changes: 24 additions & 6 deletions src/__tests__/__snapshots__/importEvent.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Array [
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
"referrername": "referrerName",
"referrertype": "referrerType",
"region": "Buenos Aires",
"serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
"siteSearchKeyword": undefined,
Expand All @@ -54,6 +56,7 @@ Array [
},
"userid": "24",
"visitduration": "300",
"visitorid": "visitorId",
"visitortype": "returningCustomer",
},
Object {
Expand Down Expand Up @@ -86,6 +89,8 @@ Array [
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
"referrername": "referrerName",
"referrertype": "referrerType",
"region": "Buenos Aires",
"serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
"siteSearchKeyword": undefined,
Expand All @@ -105,6 +110,7 @@ Array [
"usercustomproperties": Object {},
"userid": "24",
"visitduration": "300",
"visitorid": "visitorId",
"visitortype": "returningCustomer",
},
Object {
Expand Down Expand Up @@ -137,6 +143,8 @@ Array [
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
"referrername": "referrerName",
"referrertype": "referrerType",
"region": "Buenos Aires",
"serverdateprettyfirstaction": "2021-08-20T21:55:12.000Z",
"siteSearchKeyword": "scuba",
Expand All @@ -156,6 +164,7 @@ Array [
"usercustomproperties": Object {},
"userid": "24",
"visitduration": "300",
"visitorid": "visitorId",
"visitortype": "returningCustomer",
},
]
Expand All @@ -165,8 +174,8 @@ exports[`importEvent: should extract events from matomo visit actionsDetails and
Array [
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -181,6 +190,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -225,8 +237,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -241,6 +253,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down Expand Up @@ -282,8 +297,8 @@ Array [
],
Array [
"insert into matomo
(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)
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)
(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)
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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand All @@ -298,6 +313,9 @@ Array [
"300",
"23",
"returningCustomer",
"visitorId",
"referrerType",
"referrerName",
"tests",
"24",
"2021-08-20T21:55:12.000Z",
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ CREATE TABLE IF NOT EXISTS matomo
dimension10 text,
action_url text,
sitesearchkeyword text,
action_title text
action_title text,
visitorid text,
referrertype text,
referrername text
) PARTITION BY RANGE (action_timestamp);
",
Array [],
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const matomoVisit = require("./visit.json");

const run = require("../index");

const NB_REQUEST_TO_INIT_DB = 1; // Number of query to init DB (createTable.js)
const NB_REQUEST_TO_INIT_DB = 3; // Number of query to init DB (createTable.js)
const TEST_DATE = new Date();

// @ts-ignore
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/visit.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"daysSinceFirstVisit": "23",
"actions": "2",
"visitorType": "returningCustomer",
"visitorId": "visitorId",
"referrerType": "referrerType",
"referrerName": "referrerName",
"siteName": "tests",
"userId": "24",
"region": "Buenos Aires",
Expand Down
Loading