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
|
|
@ -44,6 +44,7 @@ import { useEventTarget } from "./useEvents";
|
|||
declare global {
|
||||
interface Window {
|
||||
matrixclient: MatrixClient;
|
||||
isPasswordlessUser: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,9 +119,6 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
|||
if (widget) {
|
||||
// We're inside a widget, so let's engage *matryoshka mode*
|
||||
logger.log("Using a matryoshka client");
|
||||
PosthogAnalytics.instance.setRegistrationType(
|
||||
RegistrationType.Registered
|
||||
);
|
||||
return {
|
||||
client: await widget.client,
|
||||
isPasswordlessUser: false,
|
||||
|
|
@ -138,11 +136,6 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
|||
session;
|
||||
|
||||
try {
|
||||
PosthogAnalytics.instance.setRegistrationType(
|
||||
passwordlessUser
|
||||
? RegistrationType.Guest
|
||||
: RegistrationType.Registered
|
||||
);
|
||||
return {
|
||||
client: await initClient(
|
||||
{
|
||||
|
|
@ -345,7 +338,8 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
|||
|
||||
useEffect(() => {
|
||||
window.matrixclient = client;
|
||||
}, [client]);
|
||||
window.isPasswordlessUser = isPasswordlessUser;
|
||||
}, [client, isPasswordlessUser]);
|
||||
|
||||
if (error) {
|
||||
return <ErrorView error={error} />;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue