Posthog widget embedding (#767)
* load analytics id from url in embedded mode Signed-off-by: Timo K <timok@element.io> * add start call in the widget code path Signed-off-by: Timo K <timok@element.io> * send group call id instead of call name Signed-off-by: Timo K <timok@element.io> * generate analyticsid based on account analyticsid This make it impossible to find users from the element web posthog instance in the element call instance * move registration type setup PosthogAnalytics.ts * Order identificaition and tracking. This fixes an issue that the widget version did not identify the user before sneding the first track event. Because start call is called right after app startup. Signed-off-by: Timo K <timok@element.io>
This commit is contained in:
parent
b60a92112f
commit
e3aa810230
7 changed files with 143 additions and 51 deletions
|
|
@ -22,7 +22,7 @@ import {
|
|||
|
||||
interface CallEnded extends IPosthogEvent {
|
||||
eventName: "CallEnded";
|
||||
callName: string;
|
||||
callId: string;
|
||||
callParticipantsOnLeave: number;
|
||||
callParticipantsMax: number;
|
||||
callDuration: number;
|
||||
|
|
@ -45,10 +45,10 @@ export class CallEndedTracker {
|
|||
);
|
||||
}
|
||||
|
||||
track(callName: string, callParticipantsNow: number) {
|
||||
track(callId: string, callParticipantsNow: number) {
|
||||
PosthogAnalytics.instance.trackEvent<CallEnded>({
|
||||
eventName: "CallEnded",
|
||||
callName,
|
||||
callId: callId,
|
||||
callParticipantsMax: this.cache.maxParticipantsCount,
|
||||
callParticipantsOnLeave: callParticipantsNow,
|
||||
callDuration: (Date.now() - this.cache.startTime.getTime()) / 1000,
|
||||
|
|
@ -58,14 +58,14 @@ export class CallEndedTracker {
|
|||
|
||||
interface CallStarted extends IPosthogEvent {
|
||||
eventName: "CallStarted";
|
||||
callName: string;
|
||||
callId: string;
|
||||
}
|
||||
|
||||
export class CallStartedTracker {
|
||||
track(callName: string) {
|
||||
track(callId: string) {
|
||||
PosthogAnalytics.instance.trackEvent<CallStarted>({
|
||||
eventName: "CallStarted",
|
||||
callName,
|
||||
callId: callId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue