Skip to content

Commit e408e24

Browse files
author
Llorenç Muntaner
authored
Use origin on login and registration funnel (#2985)
1 parent 34a0db0 commit e408e24

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// applications that want to authenticate the user using Internet Identity
33
import { analytics } from "$src/utils/analytics/analytics";
44
import { loginFunnel } from "$src/utils/analytics/loginFunnel";
5+
import { registrationFunnel } from "$src/utils/analytics/registrationFunnel";
56
import { type SignedDelegation as FrontendSignedDelegation } from "@dfinity/identity";
67
import { Principal } from "@dfinity/principal";
78
import { z } from "zod";
@@ -131,8 +132,8 @@ export async function authenticationProtocol({
131132
analytics.event("authorize-client-request-valid", {
132133
origin: requestOrigin,
133134
});
134-
// TODO: Add origin to login funnel
135-
loginFunnel.init();
135+
loginFunnel.init({ origin: requestOrigin });
136+
registrationFunnel.init({ origin: requestOrigin });
136137

137138
const authContext = {
138139
authRequest: requestResult.request,

src/frontend/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { createSpa } from "./spa";
1111
import { getAddDeviceAnchor } from "./utils/addDeviceLink";
1212
import { analytics, initAnalytics } from "./utils/analytics/analytics";
1313
import { registrationFunnel } from "./utils/analytics/registrationFunnel";
14+
import { loginFunnel } from "./utils/analytics/loginFunnel";
1415

1516
void createSpa(async (connection) => {
1617
initAnalytics(connection.canisterConfig.analytics_config[0]?.[0]);
@@ -51,7 +52,6 @@ void createSpa(async (connection) => {
5152
// Simple, #-based routing
5253
if (url.hash === "#authorize") {
5354
analytics.event("page-authorize");
54-
registrationFunnel.init();
5555
// User was brought here by a dapp for authorization
5656
return authFlowAuthorize(connection);
5757
} else if (url.hash === WEBAUTHN_IFRAME_PATH) {
@@ -60,7 +60,9 @@ void createSpa(async (connection) => {
6060
return webAuthnInIframeFlow(connection);
6161
} else {
6262
analytics.event("page-manage");
63+
// Initialize funnels without origin.
6364
registrationFunnel.init();
65+
loginFunnel.init();
6466
// The default flow
6567
return authFlowManage(connection);
6668
}

0 commit comments

Comments
 (0)