add event tracking

This commit is contained in:
Bill Yang 2025-03-15 21:41:41 -07:00
parent a622799599
commit fcdbe1429f
7 changed files with 291 additions and 163 deletions

View file

@ -10,6 +10,9 @@ type TotalPayload = TrackingPayload & {
ua: UAParser.IResult;
referrer: string;
ipAddress: string;
event_type?: string;
event_name?: string;
properties?: string;
};
class PageviewQueue {
@ -82,6 +85,9 @@ class PageviewQueue {
country: countryCode,
iso_3166_2:
countryCode && regionCode ? countryCode + "-" + regionCode : "",
event_type: pv.event_type || "pageview",
event_name: pv.event_name || "",
properties: pv.properties,
};
});