mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-11 12:25:36 +02:00
Update TopBar component to include an image and enhance UTM parameter tracking in the backend
- Replaced text link with an image link in the TopBar component for improved branding. - Added UTM parameters to the Clickhouse database schema for better tracking of marketing campaigns. - Implemented UTM parameter extraction utility and integrated it into the pageview tracking process.
This commit is contained in:
parent
0b9a1f702e
commit
b234a72f06
6 changed files with 44 additions and 26 deletions
|
@ -3,7 +3,7 @@ import clickhouse from "../db/clickhouse/clickhouse.js";
|
|||
import { TrackingPayload } from "../types.js";
|
||||
import { getDeviceType } from "../utils.js";
|
||||
import { getChannel } from "./getChannel.js";
|
||||
import { clearSelfReferrer } from "./trackingUtils.js";
|
||||
import { clearSelfReferrer, getUTMParams } from "./trackingUtils.js";
|
||||
|
||||
type TotalPayload = TrackingPayload & {
|
||||
userId: string;
|
||||
|
@ -71,6 +71,9 @@ class PageviewQueue {
|
|||
// Check if referrer is from the same domain and clear it if so
|
||||
let referrer = clearSelfReferrer(pv.referrer || "", pv.hostname || "");
|
||||
|
||||
// Get UTM parameters
|
||||
const utmParams = getUTMParams(pv.querystring || "");
|
||||
|
||||
return {
|
||||
site_id: pv.site_id,
|
||||
timestamp: DateTime.fromISO(pv.timestamp).toFormat(
|
||||
|
@ -101,6 +104,11 @@ class PageviewQueue {
|
|||
type: pv.type || "pageview",
|
||||
event_name: pv.event_name || "",
|
||||
properties: pv.properties,
|
||||
utm_source: utmParams["utm_source"] || "",
|
||||
utm_medium: utmParams["utm_medium"] || "",
|
||||
utm_campaign: utmParams["utm_campaign"] || "",
|
||||
utm_term: utmParams["utm_term"] || "",
|
||||
utm_content: utmParams["utm_content"] || "",
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue