From 528abadd7ca9a4afa07ed08d39a6451efd28428d Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Thu, 1 Jun 2023 18:55:11 +0200 Subject: [PATCH] tests --- docker-compose.yml | 7 +- .../__snapshots__/importDate.test.ts.snap | 2427 +++++++++++++++++ src/__tests__/__snapshots__/run.test.ts.snap | 1741 ++++++++++++ src/__tests__/importDate.test.ts | 135 + src/__tests__/importEvent.test.ts | 1 + src/__tests__/index.test.ts | 198 -- src/__tests__/run.test.ts | 96 + src/migrate-latest.ts | 5 - 8 files changed, 4404 insertions(+), 206 deletions(-) create mode 100644 src/__tests__/__snapshots__/importDate.test.ts.snap create mode 100644 src/__tests__/__snapshots__/run.test.ts.snap create mode 100644 src/__tests__/importDate.test.ts delete mode 100644 src/__tests__/index.test.ts create mode 100644 src/__tests__/run.test.ts diff --git a/docker-compose.yml b/docker-compose.yml index 94d4a31..dae7c8d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,10 @@ version: "3.0" services: postgres: - build: - context: ./docker - dockerfile: ./Dockerfile + image: postgres:15 + # build: + # context: ./docker + # dockerfile: ./Dockerfile volumes: - postgres_data:/var/lib/postgresql/data environment: diff --git a/src/__tests__/__snapshots__/importDate.test.ts.snap b/src/__tests__/__snapshots__/importDate.test.ts.snap new file mode 100644 index 0000000..49c2857 --- /dev/null +++ b/src/__tests__/__snapshots__/importDate.test.ts.snap @@ -0,0 +1,2427 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`importDate: should paginate matomo API calls and produce 46 queries 3`] = ` +[ + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-04-15", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "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", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "action_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("idsite", "actions", "country", "region", "city", "operatingsystemname", "devicemodel", "devicebrand", "visitduration", "dayssincefirstvisit", "visitortype", "visitorid", "referrertype", "referrername", "sitename", "userid", "serverdateprettyfirstaction", "action_id", "action_type", "action_title", "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) on conflict do nothing", + [ + "42", + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "undefined_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], +] +`; diff --git a/src/__tests__/__snapshots__/run.test.ts.snap b/src/__tests__/__snapshots__/run.test.ts.snap new file mode 100644 index 0000000..71c5c3c --- /dev/null +++ b/src/__tests__/__snapshots__/run.test.ts.snap @@ -0,0 +1,1741 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`run: should fetch the latest 5 days on matomo 1`] = ` +[ + { + "date": "2023-03-29", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", + }, + { + "date": "2023-03-30", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", + }, + { + "date": "2023-03-31", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", + }, + { + "date": "2023-04-01", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", + }, + { + "date": "2023-04-02", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", + }, +] +`; + +exports[`run: should fetch the latest event date if no date provided 1`] = ` +[ + "select action_timestamp at time zone 'UTC' as "action_timestamp" from "matomo" order by "action_timestamp" desc limit $1", + [ + 1, + ], +] +`; + +exports[`run: should run SQL queries 1`] = ` +[ + [ + "select action_timestamp at time zone 'UTC' as "action_timestamp" from "matomo" order by "action_timestamp" desc limit $1", + [ + 1, + ], + ], + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-03-29", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-03-30", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-03-31", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-04-01", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-04-02", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 123, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "123_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_0", + "event", + "Evènement", + "Ecommerce", + "Cart change", + "added - Basic Wetsuit", + 1, + 48, + "2021-08-20T21:35:18.000Z", + "https://dive-shop.net/products/basic-wetsuit/", + { + "page-author": "Julien", + "post-age": "-430 days", + }, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_timespent", "action_timestamp", "action_url", "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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_1", + "action", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:25.000Z", + "https://dive-shop.net/products/diving-boots/", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], + [ + "insert into "matomo" ("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_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) on conflict do nothing", + [ + "42", + 124, + "2", + "Argentine", + "Buenos Aires", + "Buenos Aires", + "Mac", + "Générique Bureau", + "Inconnu", + "300", + "23", + "returningCustomer", + "visitorId", + "referrerType", + "referrerName", + "tests", + "24", + "2021-08-20T21:55:12.000Z", + "124_2", + "search", + "Divezone Brand Diving Boots - Divezone Store", + "2", + "2021-08-20T21:30:22.000Z", + "https://dive-shop.net/products/diving-boots/", + "scuba", + {}, + { + "dimension1": "guest", + "dimension10": "36", + "dimension2": "julien", + "dimension3": "page", + "dimension4": "indonesia", + "dimension5": "diving", + "dimension6": "shop", + "dimension7": "v1.2.3", + "dimension8": "fr", + "dimension9": "light", + }, + "guest", + "julien", + "page", + "indonesia", + "diving", + "shop", + "v1.2.3", + "fr", + "light", + "36", + ], + ], +] +`; diff --git a/src/__tests__/importDate.test.ts b/src/__tests__/importDate.test.ts new file mode 100644 index 0000000..5ebf6da --- /dev/null +++ b/src/__tests__/importDate.test.ts @@ -0,0 +1,135 @@ +process.env.MATOMO_SITE = "42"; +process.env.PROJECT_NAME = "some-project"; +process.env.RESULTPERPAGE = "10"; + +import { Pool } from "pg"; + +import matomoVisit from "./visit.json"; + +import { importDate } from "../importDate"; + +const TEST_DATE = new Date(2023, 3, 15); + +let queries: any[] = []; + +let result = { + command: "string", + rowCount: 0, +}; + +jest.mock("pg", () => { + const client = { + query: (query: string, values: any) => { + queries.push([query, values]); + return result; + }, + release: jest.fn(), + }; + const methods = { + connect: () => client, + on: jest.fn(), + query: jest.fn(), + }; + return { Pool: jest.fn(() => methods) }; +}); + +let pool: any; +beforeEach(() => { + pool = new Pool(); + queries = []; +}); +afterEach(() => { + jest.clearAllMocks(); +}); + +test("importDate: should import given date", async () => { + const piwikApi = jest.fn(); + + piwikApi.mockImplementation((options, cb) => { + cb(null, [ + { + ...matomoVisit, + idVisit: 123, + }, + { + ...matomoVisit, + idVisit: 124, + }, + ]); + }); + + pool.query.mockResolvedValueOnce({ rows: [], rowCount: 0 }); + + await importDate(piwikApi, TEST_DATE); + + expect(piwikApi.mock.calls.length).toEqual(1); + + expect(piwikApi.mock.calls[0][0]).toMatchInlineSnapshot(` +{ + "date": "2023-04-15", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", +} +`); + expect(queries[0]).toMatchInlineSnapshot(` +[ + "select count(distinct "idvisit") as "count" from "matomo" where date(timezone('UTC', action_timestamp)) = $1", + [ + "2023-04-15", + ], +] +`); + expect(queries.length).toEqual(1 + matomoVisit.actionDetails.length * 2); +}); + +test("importDate: should paginate matomo API calls and produce 46 queries", async () => { + const piwikApi = jest.fn(); + let calls = 0; + + piwikApi.mockImplementation((options, cb) => { + cb( + null, + Array.from({ length: calls ? 5 : 10 }, (k, v) => ({ + ...matomoVisit, + idVisit: k, + })) + ); + calls++; + }); + + pool.query.mockResolvedValueOnce({ rows: [], rowCount: 0 }); + + await importDate(piwikApi, TEST_DATE); + + expect(piwikApi.mock.calls.length).toEqual(2); + + expect(piwikApi.mock.calls[0][0]).toMatchInlineSnapshot(` +{ + "date": "2023-04-15", + "filter_limit": 10, + "filter_offset": 0, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", +} +`); + expect(piwikApi.mock.calls[1][0]).toMatchInlineSnapshot(` +{ + "date": "2023-04-15", + "filter_limit": 10, + "filter_offset": 10, + "filter_sort_order": "asc", + "idSite": "42", + "method": "Live.getLastVisitsDetails", + "period": "day", +} +`); + + expect(queries.length).toEqual(1 + matomoVisit.actionDetails.length * 15); + expect(queries).toMatchSnapshot(); +}); diff --git a/src/__tests__/importEvent.test.ts b/src/__tests__/importEvent.test.ts index 5d6ffcc..787a759 100644 --- a/src/__tests__/importEvent.test.ts +++ b/src/__tests__/importEvent.test.ts @@ -1,5 +1,6 @@ process.env.MATOMO_SITE = "42"; process.env.PROJECT_NAME = "some-project"; +process.env.RESULTPERPAGE = "10"; import matomoVisit from "./visit.json"; import { getEventsFromMatomoVisit } from "../importEvent"; diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts deleted file mode 100644 index 1c49d07..0000000 --- a/src/__tests__/index.test.ts +++ /dev/null @@ -1,198 +0,0 @@ -const mock_pgQuery = jest.fn(); -const mock_matomoApi = jest.fn(); -// import formatISO from "date-fns/formatISO"; -// import addDays from "date-fns/addDays"; - -// import { INITIAL_OFFSET } from "../config"; - -process.env.MATOMO_SITE = "42"; -process.env.PROJECT_NAME = "some-project"; - -// import matomoVisit from "./visit.json"; - -// import run from "../index"; - -// const NB_REQUEST_TO_INIT_DB = 3; // Number of query to init DB (createTable.js) -// const TEST_DATE = new Date(); - -// @ts-ignore -//const isoDate = (date) => formatISO(date, { representation: "date" }); - -// jest.mock("pg", () => { -// class Client { -// escapeIdentifier(name) { -// return name; -// } -// end() {} -// connect() { -// return Promise.resolve(); -// } -// query(...args) { -// return Promise.resolve(mock_pgQuery(...args)); -// } -// } -// return { -// Client, -// }; -// }); - -// jest.mock("piwik-client", () => { -// class MatomoClient { -// api(...args: any[]) { -// return mock_matomoApi(...args); -// } -// } -// return MatomoClient; -// }); - -test("test", () => {}); -/* - -beforeEach(() => { - jest.resetAllMocks(); - jest.resetModules(); - process.env.STARTDATE = ""; - //process.env.OFFSET = ""; -}); - -test("run: should create table", async () => { - mock_pgQuery.mockReturnValue({ rows: [] }); - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, []); - }); - await run(); - expect(mock_pgQuery.mock.calls[0]).toMatchSnapshot(); -}); - -test("run: should fetch the latest event date if no date provided", async () => { - jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); - mock_pgQuery.mockReturnValue({ rows: [] }); - - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, [ - { - ...matomoVisit, - idVisit: 123, - }, - { - ...matomoVisit, - idVisit: 124, - }, - ]); - }); - - await run(); - - // check matomo requests - expect(mock_matomoApi.mock.calls[0][0].date).toEqual(isoDate(TEST_DATE)); - expect(mock_matomoApi.mock.calls[0][0].filter_offset).toEqual(0); - - // check db queries - expect(mock_pgQuery.mock.calls[NB_REQUEST_TO_INIT_DB][0]).toEqual( - "select action_timestamp from matomo order by action_timestamp desc limit 1" - ); -}); - -test("run: should resume using latest event date - offset if no date provided", async () => { - jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); - - const LAST_EVENT_DATE_OFFSET = 2; - // @ts-ignore - const LAST_EVENT_DATE = addDays(TEST_DATE, -LAST_EVENT_DATE_OFFSET); - - mock_pgQuery.mockReturnValue({ rows: [{ action_timestamp: LAST_EVENT_DATE.getTime() }] }); - - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, [ - { - ...matomoVisit, - idVisit: 123, - }, - { - ...matomoVisit, - idVisit: 124, - }, - ]); - }); - - await run(); - - // check matomo requests - expect(mock_matomoApi.mock.calls[0][0].date).toEqual( - // @ts-ignore - isoDate(addDays(LAST_EVENT_DATE, -parseInt(INITIAL_OFFSET))) - ); - expect(mock_matomoApi.mock.calls[0][0].filter_offset).toEqual(0); - - const daysCount = LAST_EVENT_DATE_OFFSET + parseInt(INITIAL_OFFSET) + 1; - expect(mock_matomoApi.mock.calls.length).toEqual(daysCount); - - // check db queries - expect(mock_pgQuery.mock.calls.length).toEqual(NB_REQUEST_TO_INIT_DB + 1 + daysCount * 7); // NB_REQUEST_TO_INIT_DB + select queries + days offset -}); - -test("run: should use today date if nothing in DB", async () => { - jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); - mock_pgQuery.mockReturnValue({ rows: [] }); - - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, [ - { - ...matomoVisit, - idVisit: 123, - }, - ]); - }); - - await run(); - - // check matomo requests - expect(mock_matomoApi.mock.calls.length).toEqual(1); - expect(mock_matomoApi.mock.calls[0][0].date).toEqual(isoDate(TEST_DATE)); - - // check the 4 events inserted - expect(mock_pgQuery.mock.calls.length).toEqual(NB_REQUEST_TO_INIT_DB + 5); // NB_REQUEST_TO_INIT_DB + check date + latest + 2 inserts -}); - -test("run: should use given date if any", async () => { - jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); - mock_pgQuery.mockReturnValue({ rows: [] }); - - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, [ - { - ...matomoVisit, - idVisit: 123, - }, - ]); - }); - - // @ts-ignore - await run(isoDate(addDays(TEST_DATE, -10)) + "T00:00:00.000Z"); - - expect(mock_matomoApi.mock.calls.length).toEqual(11); - expect(mock_pgQuery.mock.calls.length).toEqual(NB_REQUEST_TO_INIT_DB + 11 * 4); // NB_REQUEST_TO_INIT_DB + inserts. no initial select as date is provided -}); - -test("run: should use STARTDATE if any", async () => { - // @ts-ignore - process.env.STARTDATE = isoDate(addDays(TEST_DATE, -5)) + "T00:00:00.000Z"; - jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); - mock_pgQuery.mockReturnValue({ rows: [] }); - - mock_matomoApi.mockImplementation((options, cb) => { - return cb(null, [ - { - ...matomoVisit, - idVisit: 123, - }, - ]); - }); - - await run(); - - expect(mock_matomoApi.mock.calls.length).toEqual(6); - - expect(mock_pgQuery.mock.calls.length).toEqual(NB_REQUEST_TO_INIT_DB + 1 + 6 * 4); // NB_REQUEST_TO_INIT_DB + initial select + inserts. -}); -*/ diff --git a/src/__tests__/run.test.ts b/src/__tests__/run.test.ts new file mode 100644 index 0000000..f693dc1 --- /dev/null +++ b/src/__tests__/run.test.ts @@ -0,0 +1,96 @@ +process.env.MATOMO_SITE = "42"; +process.env.PROJECT_NAME = "some-project"; +process.env.RESULTPERPAGE = "10"; + +import { Client, Pool } from "pg"; + +import matomoVisit from "./visit.json"; + +import run from "../index"; + +const TEST_DATE = new Date(2023, 3, 1); + +let queries: any[] = []; + +let result: Record = { + command: "string", + rowCount: 0, +}; + +jest.mock("pg", () => { + const client = { + query: (query: string, values: any) => { + queries.push([query, values]); + return result; + }, + release: jest.fn(), + }; + const methods = { + connect: () => client, + on: jest.fn(), + query: jest.fn(), + }; + return { Pool: jest.fn(() => methods) }; +}); + +let pool: any; +beforeEach(() => { + pool = new Pool(); + queries = []; + piwikApiCalls = []; +}); +afterEach(() => { + jest.clearAllMocks(); +}); + +let piwikApiCalls: any[] = []; + +jest.mock("piwik-client", () => { + const matomoVisits = [ + { + ...matomoVisit, + idVisit: 123, + }, + { + ...matomoVisit, + idVisit: 124, + }, + ]; + class PiwikMock { + options: any; + constructor(options: any) { + this.options = options; + } + api(options: any, cb: Function) { + piwikApiCalls.push(options); + cb(null, matomoVisits); + (""); + } + } + + return PiwikMock; +}); + +test("run: should fetch the latest 5 days on matomo", async () => { + jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); + await run(); + expect(piwikApiCalls).toMatchSnapshot(); +}); + +test("run: should fetch the latest event date if no date provided", async () => { + jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); + await run(); + expect(queries[0]).toMatchSnapshot(); +}); + +test("run: should run based on existing data if any", async () => { + // ensure we use the latest entry in DB + expect(1).toEqual(1); +}); + +test("run: should run SQL queries", async () => { + jest.useFakeTimers().setSystemTime(TEST_DATE.getTime()); + await run(); + expect(queries).toMatchSnapshot(); + expect(queries.length).toEqual(1 + 5 * (6 + 1)); +}); diff --git a/src/migrate-latest.ts b/src/migrate-latest.ts index 6120707..5b14cdc 100644 --- a/src/migrate-latest.ts +++ b/src/migrate-latest.ts @@ -13,11 +13,6 @@ async function migrateToLatest() { .where("extname", "=", "pg_partman") .executeTakeFirst(); - if (extension) { - console.error("pg_partman extension detected; Skip migrations"); - return; - } - const migrator = new Migrator({ db, provider: new FileMigrationProvider({