mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-11 12:25:36 +02:00
wip
This commit is contained in:
parent
071c65e5b4
commit
c928e9ccbb
3 changed files with 47 additions and 13 deletions
|
@ -56,11 +56,14 @@ class PageviewQueue {
|
|||
// Process each pageview with its geo data
|
||||
const processedPageviews = batch.map((pv) => {
|
||||
const countryCode = geoData?.[pv.ipAddress]?.data?.countryIso || "";
|
||||
const regionCode = geoData?.[pv.ipAddress]?.data?.subdivisions?.[0]?.isoCode || "";
|
||||
const regionCode =
|
||||
geoData?.[pv.ipAddress]?.data?.subdivisions?.[0]?.isoCode || "";
|
||||
|
||||
return {
|
||||
site_id: pv.site_id,
|
||||
timestamp: DateTime.fromISO(pv.timestamp).toFormat("yyyy-MM-dd HH:mm:ss"),
|
||||
timestamp: DateTime.fromISO(pv.timestamp).toFormat(
|
||||
"yyyy-MM-dd HH:mm:ss"
|
||||
),
|
||||
session_id: pv.sessionId,
|
||||
user_id: pv.userId,
|
||||
hostname: pv.hostname || "",
|
||||
|
@ -77,8 +80,9 @@ class PageviewQueue {
|
|||
screen_height: pv.screenHeight || 0,
|
||||
device_type: getDeviceType(pv.screenWidth, pv.screenHeight, pv.ua),
|
||||
country: countryCode,
|
||||
iso_3166_2: countryCode && regionCode ? countryCode + "-" + regionCode : "",
|
||||
}
|
||||
iso_3166_2:
|
||||
countryCode && regionCode ? countryCode + "-" + regionCode : "",
|
||||
};
|
||||
});
|
||||
|
||||
console.info("bulk insert: ", processedPageviews.length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue