File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// applications that want to authenticate the user using Internet Identity
33import { analytics } from "$src/utils/analytics/analytics" ;
44import { loginFunnel } from "$src/utils/analytics/loginFunnel" ;
5+ import { registrationFunnel } from "$src/utils/analytics/registrationFunnel" ;
56import { type SignedDelegation as FrontendSignedDelegation } from "@dfinity/identity" ;
67import { Principal } from "@dfinity/principal" ;
78import { 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 ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { createSpa } from "./spa";
1111import { getAddDeviceAnchor } from "./utils/addDeviceLink" ;
1212import { analytics , initAnalytics } from "./utils/analytics/analytics" ;
1313import { registrationFunnel } from "./utils/analytics/registrationFunnel" ;
14+ import { loginFunnel } from "./utils/analytics/loginFunnel" ;
1415
1516void 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 }
You can’t perform that action at this time.
0 commit comments