📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fixed regions / cities data generation
Blue Mouseeb688db849c2
diff --git a/meta/clickhouse/generate-dummy-data.js b/meta/clickhouse/generate-dummy-data.jsindex 735c2d582..6b679146b 100644--- a/meta/clickhouse/generate-dummy-data.js+++ b/meta/clickhouse/generate-dummy-data.js@@ -1,3 +1,4 @@+/* eslint-disable */const { faker } = require('@faker-js/faker')const _ = require('lodash')const chalk = require('chalk')@@ -20,6 +21,20 @@ const URLS = Array.from({ length: 36 }, () => faker.internet.url())const DEVICES = ['desktop', 'mobile', 'tablet', 'wearable']const BROWSERS = ['Chrome', 'Firefox', 'Safari', 'Opera', 'Edge', 'IE']const CUSTOM_EVENTS = ['click', 'hover', 'scroll', 'submit', 'error', 'signup', 'oauth', 'test', 'hello', '235535123433']+const REGIONS = [+ 'England', 'Scotland', 'Wales', 'Northern Ireland', // UK+ 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', // USA+ 'Kyiv Oblast', 'Kharkiv Oblast', 'Vinnytsia Oblast', 'Donetsk Oblast', 'Odessa Oblast', 'Zaporizhia Oblast', 'Lviv Oblast', 'Kiev', // Ukraine+ 'Ontario', 'Quebec', 'Nova Scotia', 'New Brunswick', 'Manitoba', 'British Columbia', 'Prince Edward Island', 'Saskatchewan', // Canada+ 'Tokyo', 'Osaka', 'Aichi', 'Hokkaido', 'Fukuoka', 'Kanagawa', 'Ibaraki', 'Saitama', // Japan+]+const CITIES = [+ 'London', 'Birmingham', 'Dundee', 'Liverpool', 'Bristol', 'Manchester', 'Sheffield', 'Leeds', // UK+ 'New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix', 'Philadelphia', 'San Antonio', 'San Diego', // USA+ 'Kyiv', 'Kharkiv', 'Vinnytsia', 'Donetsk', 'Odessa', 'Zaporizhia', 'Lviv', 'Dnipro', // Ukraine+ 'Toronto', 'Montreal', 'Vancouver', 'Ottawa', 'Calgary', 'Edmonton', 'Winnipeg', 'Quebec City', // Canada+ 'Tokyo', 'Osaka', 'Nagoya', 'Sapporo', 'Fukuoka', 'Yokohama', 'Sendai', 'Kobe', // Japan+]const chunkArray = (arr, chunkSize = 1000) => {const result = []@@ -80,8 +95,8 @@ const generateAnalyticsData = async (pid, rowCount, from, to) => {faker.helpers.arrayElement(UTM_MEDIUMS), // mefaker.helpers.arrayElement(UTM_CAMPAIGNS), // cafaker.location.countryCode(), // cc- faker.location.state(), // rg- faker.location.city(), // ct+ faker.helpers.arrayElement(REGIONS), // rg+ faker.helpers.arrayElement(CITIES), // ctfaker.number.int({ min: 0, max: 10000 }), // sdurfaker.number.int({ min: 0, max: 9 }) === 0 ? 1 : 0, // unique; 10% chance of unique record_.split(faker.date.between({ from, to }).toISOString().replace('T', ' ').replace('Z', ''), '.')[0], // created; format the date string@@ -138,8 +153,8 @@ const generateCustomEventsData = async (pid, rowCount, from, to) => {faker.helpers.arrayElement(UTM_MEDIUMS), // mefaker.helpers.arrayElement(UTM_CAMPAIGNS), // cafaker.location.countryCode(), // cc- faker.location.state(), // rg- faker.location.city(), // ct+ faker.helpers.arrayElement(REGIONS), // rg+ faker.helpers.arrayElement(CITIES), // ct_.split(faker.date.between({ from, to }).toISOString().replace('T', ' ').replace('Z', ''), '.')[0], // created; format the date string]records.push(record)@@ -163,8 +178,8 @@ const generatePerformanceData = async (pid, rowCount, from, to) => {faker.helpers.arrayElement(DEVICES), // dvfaker.helpers.arrayElement(BROWSERS), // brfaker.location.countryCode(), // cc- faker.location.state(), // rg- faker.location.city(), // ct+ faker.helpers.arrayElement(REGIONS), // rg+ faker.helpers.arrayElement(CITIES), // ctfaker.number.int({ min: 0, max: 500 }), // dnsfaker.number.int({ min: 0, max: 1000 }), // tlsfaker.number.int({ min: 0, max: 100 }), // conn