Skip to content

Commit

Permalink
Merge pull request #38 from rap2hpoutre/feat--dimension-flat
Browse files Browse the repository at this point in the history
test: 10 dimensions
  • Loading branch information
goffle authored Jun 7, 2022
2 parents faf6177 + af670a9 commit 69b11d2
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 19 deletions.
54 changes: 42 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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -60,12 +60,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -100,12 +105,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -140,12 +150,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -183,12 +198,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -223,12 +243,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -263,6 +288,11 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
]
Expand Down
42 changes: 36 additions & 6 deletions src/__tests__/__snapshots__/importEvent.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ Array [
"devicebrand": "Inconnu",
"devicemodel": "Générique Bureau",
"dimension1": "guest",
"dimension10": "36",
"dimension2": "julien",
"dimension3": "page",
"dimension4": "indonesia",
"dimension5": "diving",
"dimension6": "shop",
"dimension7": "v1.2.3",
"dimension8": "fr",
"dimension9": "light",
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
Expand Down Expand Up @@ -57,10 +62,15 @@ Array [
"devicebrand": "Inconnu",
"devicemodel": "Générique Bureau",
"dimension1": "guest",
"dimension10": "36",
"dimension2": "julien",
"dimension3": "page",
"dimension4": "indonesia",
"dimension5": "diving",
"dimension6": "shop",
"dimension7": "v1.2.3",
"dimension8": "fr",
"dimension9": "light",
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
Expand Down Expand Up @@ -91,10 +101,15 @@ Array [
"devicebrand": "Inconnu",
"devicemodel": "Générique Bureau",
"dimension1": "guest",
"dimension10": "36",
"dimension2": "julien",
"dimension3": "page",
"dimension4": "indonesia",
"dimension5": "diving",
"dimension6": "shop",
"dimension7": "v1.2.3",
"dimension8": "fr",
"dimension9": "light",
"idsite": "42",
"idvisit": "124",
"operatingsystemname": "Mac",
Expand All @@ -114,8 +129,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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -153,12 +168,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -193,12 +213,17 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
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, dimension1, dimension2, dimension3, dimension4, dimension5)
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)
(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, 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)
ON CONFLICT DO NOTHING",
Array [
"42",
Expand Down Expand Up @@ -233,6 +258,11 @@ Array [
"page",
"indonesia",
"diving",
"shop",
"v1.2.3",
"fr",
"light",
"36",
],
],
]
Expand Down
5 changes: 5 additions & 0 deletions src/__tests__/visit.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"city": "Buenos Aires",
"dimension1": "guest",
"dimension3": "page",
"dimension6": "shop",
"dimension7": "v1.2.3",
"dimension8": "fr",
"dimension9": "light",
"dimension10": "36",
"firstActionTimestamp": 1629496512,
"actionDetails": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/importEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const getEventsFromMatomoVisit = (matomoVisit) => {

/** @type {Record<string, string>} */
const usercustomdimensions = {};
for (let k = 1; k < 10; k++) {
for (let k = 1; k < 11; k++) {
const dimension = `dimension${k}`;
const value = actionDetail[dimension] || matomoVisit[dimension];
if (!value) continue; // max 10 custom variables
Expand Down
5 changes: 5 additions & 0 deletions types/matomo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export type Visit = {
dimension3?: string;
dimension4?: string;
dimension5?: string;
dimension6?: string;
dimension7?: string;
dimension8?: string;
dimension9?: string;
dimension10?: string;
experiments: Experiment[];
customVariables: any;
formConversions: number;
Expand Down

0 comments on commit 69b11d2

Please sign in to comment.