Commit 6acc9300 authored by lynn's avatar lynn Committed by GitHub

fix: add origin to every event (#4918)

* add origin to every event

* remove console log
parent 70d33fb2
......@@ -58,12 +58,10 @@ export const Trace = memo(
useEffect(() => {
if (shouldLogImpression) {
const origin = window.location.origin
const commitHash = process.env.REACT_APP_GIT_COMMIT_HASH
sendAnalyticsEvent(name ?? EventName.PAGE_VIEWED, {
...combinedProps,
...properties,
origin,
git_commit_hash: commitHash,
})
}
......
......@@ -35,12 +35,13 @@ export function initializeAnalytics() {
/** Sends an event to Amplitude. */
export function sendAnalyticsEvent(eventName: string, eventProperties?: Record<string, unknown>) {
const origin = window.location.origin
if (!API_KEY) {
console.log(`[analytics(${eventName})]: ${JSON.stringify(eventProperties)}`)
return
}
track(eventName, eventProperties)
track(eventName, { ...eventProperties, origin })
}
type Value = string | number | boolean | string[] | number[]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment