Skip to content

Commit 72902ee

Browse files
author
Llorenç Muntaner
authored
Close analytics funnel on funnel success (#3307)
1 parent 0539714 commit 72902ee

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/frontend/src/lib/components/wizards/migration/MigrationWizard.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
try {
5656
await migrationFlow.createPasskey(name);
5757
upgradeIdentityFunnel.trigger(UpgradeIdentityEvents.UpgradeSuccessful);
58+
upgradeIdentityFunnel.close();
5859
onSuccess(migrationFlow.identityNumber);
5960
} catch (error) {
6061
upgradeIdentityFunnel.trigger(UpgradeIdentityEvents.UpgradeFailure);

src/frontend/src/lib/legacy/flows/authorize/postMessageInterface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ export async function authenticationProtocol({
162162
try {
163163
authenticateResult = await authenticate(authContext);
164164
authorizeClientFunnel.trigger(AuthorizeClientEvents.Authenticate);
165+
authorizeClientFunnel.close();
165166
authenticationV2Funnel.trigger(AuthenticationV2Events.AuthSuccess);
167+
authenticationV2Funnel.close();
166168
} catch (error: unknown) {
167169
console.error("Unexpected error during authentication", error);
168170
authenticateResult = {

src/frontend/src/lib/utils/analytics/authenticationV2Funnel.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import { Funnel } from "./Funnel";
1111
* -> Move to select-method-screen
1212
* continue-as-passkey
1313
* auth-success
14+
* go-to-dashboard
1415
* continue-as-google
1516
* auth-success
17+
* go-to-dashboard
1618
* select-method-screen
1719
* continue-with-google
1820
* register-with-google
@@ -31,8 +33,10 @@ import { Funnel } from "./Funnel";
3133
* register-with-passkey
3234
* successful-passkey-registration
3335
* auth-success
36+
* go-to-dashboard
3437
* use-existing-passkey
3538
* auth-success
39+
* go-to-dashboard
3640
*/
3741
export const AuthenticationV2Events = {
3842
UseAnother: "use-another",
@@ -54,6 +58,7 @@ export const AuthenticationV2Events = {
5458
JwtVerificationFailed: "jwt-verification-failed",
5559
JwtVerificationExpired: "jwt-verification-expired",
5660
InfoPasskeyScreen: "info-passkey-screen",
61+
GoToDashboard: "go-to-dashboard",
5762
} as const;
5863

5964
export const authenticationV2Funnel = new Funnel<typeof AuthenticationV2Events>(

src/frontend/src/routes/(new-styling)/+page.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
import type { PageProps } from "./$types";
2222
import { onMount } from "svelte";
2323
import { triggerDropWaveAnimation } from "$lib/utils/animation-dispatcher";
24-
import { authenticationV2Funnel } from "$lib/utils/analytics/authenticationV2Funnel";
24+
import {
25+
AuthenticationV2Events,
26+
authenticationV2Funnel,
27+
} from "$lib/utils/analytics/authenticationV2Funnel";
2528
2629
const { data }: PageProps = $props();
2730
@@ -40,6 +43,8 @@
4043
lastUsedIdentitiesStore.selectIdentity(identityNumber);
4144
isAuthDialogOpen = false;
4245
void triggerDropWaveAnimation();
46+
authenticationV2Funnel.trigger(AuthenticationV2Events.GoToDashboard);
47+
authenticationV2Funnel.close();
4348
await gotoNext();
4449
};
4550
const onSignUp = async (identityNumber: bigint) => {
@@ -50,6 +55,8 @@
5055
lastUsedIdentitiesStore.selectIdentity(identityNumber);
5156
isAuthDialogOpen = false;
5257
void triggerDropWaveAnimation();
58+
authenticationV2Funnel.trigger(AuthenticationV2Events.GoToDashboard);
59+
authenticationV2Funnel.close();
5360
await gotoNext();
5461
};
5562

0 commit comments

Comments
 (0)