Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Always record string.

Brian Cao1bdaf4aca2c2
diff --git a/lib/kafka.ts b/lib/kafka.ts
index 3d3e281ce..8f5bb87f0 100644
--- a/lib/kafka.ts
+++ b/lib/kafka.ts
@@ -61,8 +61,8 @@ async function getProducer(): Promise<Producer> {
return producer;
}
-function getDateFormat(date): string {
- return dateFormat(date, 'UTC:yyyy-mm-dd HH:MM:ss');
+function getDateFormat(date, format?): string {
+ return dateFormat(date, format ? format : 'UTC:yyyy-mm-dd HH:MM:ss');
}
async function sendMessage(
diff --git a/queries/analytics/eventData/saveEventData.ts b/queries/analytics/eventData/saveEventData.ts
index 0ccc94217..9a7aa4067 100644
--- a/queries/analytics/eventData/saveEventData.ts
+++ b/queries/analytics/eventData/saveEventData.ts
@@ -36,13 +36,8 @@ async function relationalQuery(data: {
id: uuid(),
websiteEventId: eventId,
websiteId,
- key: a.key,
- stringValue:
- a.dynamicDataType === DATA_TYPE.string ||
- a.dynamicDataType === DATA_TYPE.boolean ||
- a.dynamicDataType === DATA_TYPE.array
- ? a.value
- : null,
+ eventKey: a.key,
+ stringValue: a.value.toString(),
numericValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
dataType: a.dynamicDataType,
@@ -76,11 +71,7 @@ async function clickhouseQuery(data: {
event_name: eventName,
event_key: a.key,
string_value:
- a.dynamicDataType === DATA_TYPE.string ||
- a.dynamicDataType === DATA_TYPE.boolean ||
- a.dynamicDataType === DATA_TYPE.array
- ? a.value
- : null,
+ a.dynamicDataType === DATA_TYPE.date ? getDateFormat(a.value, 'isoDateTime') : a.value,
number_value: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
date_value: a.dynamicDataType === DATA_TYPE.date ? getDateFormat(a.value) : null,
data_type: a.dynamicDataType,