Skip to content

Commit

Permalink
mixpanel-destination: fix for null 'time' property and incorrect $ins…
Browse files Browse the repository at this point in the history
…ert_id
  • Loading branch information
absorbb committed Dec 25, 2023
1 parent d18275b commit d7a602a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libs/core-functions/src/functions/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export function createFilter(filter: string): (eventType: string, eventName?: st
}

export function eventTimeSafeMs(event: AnalyticsServerEvent) {
const ts = event.timestamp ? new Date(event.timestamp as string).getTime() : undefined;
const receivedAt = event.receivedAt ? new Date(event.receivedAt as string).getTime() : undefined;
const now = new Date().getTime();
return Math.min(ts ?? now, receivedAt ?? now, now);
const ts = event.timestamp ? new Date(event.timestamp as string).getTime() : NaN;
const receivedAt = event.receivedAt ? new Date(event.receivedAt as string).getTime() : NaN;
return Math.min(!isNaN(ts) ? ts : now, !isNaN(receivedAt) ? receivedAt : now, now);
}
2 changes: 1 addition & 1 deletion libs/core-functions/src/functions/mixpanel-destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function trackEvent(
time: eventTimeSafeMs(event),
$device_id: deviceId,
distinct_id: distinctId,
$insert_id: event.messageId + "-" + randomId(),
$insert_id: hash("md5", event.messageId) + "-" + randomId(),
$user_id: event.userId ? `${event.userId}` : undefined,
$browser: ctx.ua?.browser?.name,
$browser_version: ctx.ua?.browser?.version,
Expand Down

1 comment on commit d7a602a

@vercel
Copy link

@vercel vercel bot commented on d7a602a Dec 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

new-jitsu – ./webapps/console

t.thequack.ai
thinkr.com.br
use.jitsu.com
usepolygon.io
www.sambla.se
ajewellers.com
data.uselog.io
gpt.whatfa.com
sidetrekai.com
t.papermark.io
t.saasmonk.app
use2.jitsu.com
w.d2.jitsu.com
www.kellen.top
*.dataspecc.com
app.bluetick.ai
caddy.jitsu.com
data.askloan.tw
enterticket.com
events.mitzu.io
ildar.jitsu.com
jitsu.efeer.com
jitsu.ivve.tech
krestomatio.com
sevenbillion.co
w2.d2.jitsu.com
xrt.webxr.tools
app.jotverse.com
caddy2.jitsu.com
cname2.jitsu.com
data.mysitee.com
data.toptere.com
dev-t.democo.dev
events.quenti.io
utils.doogma.com
worthsystems.com
data.music2me.com
data.timeplus.com
event-gateway.com
https.bluetick.ai
ji.degulesider.dk
jitsu.ivve.health
metabase.erxes.io
t.clickncruise.hu
test.d2.jitsu.com
cloud.yupaopao.com
data.investing.com
data.mycompany.com
data.usepolygon.io
demosite.jitsu.com
dev.driverdeck.app
n8n.paziresh24.com
new.enterticket.es
t-dev.papermark.io
test2.d2.jitsu.com
uniquecafes.com.br
www.sidetrekai.com
colectha.voolu.shop
crm.myguestcare.com
data.sidetrekai.com
data.timeplus.cloud
localhost.jitsu.com
report.improvado.io
trk.myguestcare.com
www.sevenbillion.co
analytics.mtrsvc.com
data.embeddables.com
dataqa.investing.com
dev.blazingboost.com
j.israeladvocate.org
mercury.stagehub.com
store.sidetrekai.com
teslahenry.github.io
data.hogarlylabs.tech
data.your-company.com
event.clickncruise.hu
event.clickncruise.ro
test-domain.jitsu.com
test.bigfootproof.com
teste.fazcomex.com.br
analytics.dev.knekt.io
loraboutiquedental.com
notion.twelftree.co.uk
dev-portal.zoopsign.com
event.tradejobsnz.co.nz
investing-poc.jitsu.dev
savvy-replay.jitsu.tech
data.analytics-smart.com
data.handelsregister.app
event.clickncruise.co.uk
jt.fairhopeweb.github.io
savvy-replay2.jitsu.tech
savvy-replay3.jitsu.tech
savvy-replay4.jitsu.tech
track.alquimiaweb.com.br
track.pressance-group.jp
track.uniquecafes.com.br
colectha.agenciavoolu.com
kolectha.agenciavoolu.com
lp.loraboutiquedental.com

Please sign in to comment.