mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-11 12:25:36 +02:00
add lat lon
This commit is contained in:
parent
007ced07ba
commit
12f8d06f74
3 changed files with 10 additions and 5 deletions
|
@ -58,9 +58,12 @@ 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 dataForIp = geoData?.[pv.ipAddress];
|
||||
|
||||
const countryCode = dataForIp?.data?.countryIso || "";
|
||||
const regionCode = dataForIp?.data?.subdivisions?.[0]?.isoCode || "";
|
||||
const latitude = dataForIp?.data?.latitude || 0;
|
||||
const longitude = dataForIp?.data?.longitude || 0;
|
||||
|
||||
return {
|
||||
site_id: pv.site_id,
|
||||
|
@ -85,6 +88,8 @@ class PageviewQueue {
|
|||
country: countryCode,
|
||||
iso_3166_2:
|
||||
countryCode && regionCode ? countryCode + "-" + regionCode : "",
|
||||
latitude: latitude || 0,
|
||||
longitude: longitude || 0,
|
||||
type: pv.type || "pageview",
|
||||
event_name: pv.event_name || "",
|
||||
properties: pv.properties,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue