@@ -93,12 +93,6 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
9393 " web3auth_network" to web3AuthOptions.web3AuthNetwork,
9494 )
9595 )
96- AnalyticsManager .trackEvent(
97- AnalyticsEvents .SDK_INITIALIZATION_STARTED ,
98- mutableMapOf<String , Any >(
99- " duration" to System .currentTimeMillis() - startTime,
100- )
101- )
10296
10397 val torusOptions = TorusOptions (
10498 web3AuthOptions.clientId, web3AuthOptions.web3AuthNetwork, null ,
@@ -237,11 +231,44 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
237231 // fetch project config
238232 fetchProjectConfig().whenComplete { _, err ->
239233 if (err == null ) {
234+ val properties = mutableMapOf (
235+ " chain_ids" to listOf (" eip155" , " solana" , " other" ),
236+ " logging_enabled" to web3AuthOption.enableLogging,
237+ " auth_build_env" to web3AuthOption.authBuildEnv,
238+ " auth_ux_mode" to " popup" ,
239+ " auth_mfa_settings" to emptyList<String >(),
240+ " whitelabel_logo_light_enabled" to (web3AuthOption.whiteLabel?.logoLight != null ),
241+ " whitelabel_logo_dark_enabled" to (web3AuthOption.whiteLabel?.logoDark != null ),
242+ " whitelabel_theme_mode" to (web3AuthOption.whiteLabel?.theme),
243+ " modal_auth_connector_login_methods" to listOf (
244+ " email_passwordless" ,
245+ " sms_passwordless"
246+ ),
247+ " ui_login_methods_order" to listOf (
248+ " google" ,
249+ " twitter" ,
250+ " facebook" ,
251+ " discord" ,
252+ " farcaster" ,
253+ " apple" ,
254+ " github" ,
255+ " reddit" ,
256+ " line" ,
257+ " kakao" ,
258+ " linkedin" ,
259+ " twitch" ,
260+ " wechat" ,
261+ " email_passwordless" ,
262+ " sms_passwordless"
263+ ),
264+ " duration" to System .currentTimeMillis() - startTime,
265+ " integration_type" to " android" ,
266+ " dapp_url" to this .loginParams?.dappUrl,
267+ )
268+
240269 AnalyticsManager .trackEvent(
241270 AnalyticsEvents .SDK_INITIALIZATION_COMPLETED ,
242- mutableMapOf<String , Any >(
243- " duration" to System .currentTimeMillis() - startTime,
244- )
271+ properties
245272 )
246273 // authorize session
247274 sessionManager.setSessionId(SessionManager .getSessionIdFromStorage())
@@ -262,8 +289,10 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
262289 AnalyticsManager .trackEvent(
263290 AnalyticsEvents .SDK_INITIALIZATION_FAILED ,
264291 mutableMapOf<String , Any >(
292+ " integration_type" to " android" ,
293+ " dapp_url" to " this.loginParams?.dappUrl.toString()" ,
265294 " duration" to System .currentTimeMillis() - startTime,
266- " error " to " Fetch project config API error. ${err.message} "
295+ " error_message " to " Fetch project config API error. ${err.message} "
267296 )
268297 )
269298 initializeCf.completeExceptionally(err)
@@ -312,6 +341,9 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
312341 AnalyticsManager .trackEvent(
313342 AnalyticsEvents .MFA_MANAGEMENT_FAILED ,
314343 mutableMapOf<String , Any >(
344+ " integration_type" to " android" ,
345+ " dapp_url" to this .loginParams?.dappUrl.toString(),
346+ " connector" to " auth" ,
315347 " duration" to System .currentTimeMillis() - startTime,
316348 " error_message" to " MFA Management Failed: $error "
317349 )
@@ -440,31 +472,30 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
440472 ): CompletableFuture <Web3AuthResponse > {
441473 actionType = " login"
442474
443- AnalyticsManager .trackEvent(
444- AnalyticsEvents .SOCIAL_LOGIN_SELECTED ,
445- mapOf (
446- " auth_connection" to loginParams.authConnection,
447- " auth_connection_id" to loginParams.authConnectionId,
448- " group_auth_connection_id" to loginParams.groupedAuthConnectionId,
449- " chain_id" to web3AuthOption.defaultChainId.toString(),
450- " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
451- " dappUrl" to loginParams.dappUrl,
452- )
453- )
454-
455475 this .loginParams = loginParams
456476 sessionManager = SessionManager (
457477 baseContext,
458478 web3AuthOption.sessionTime,
459479 web3AuthOption.redirectUrl,
460480 sessionNamespace = if (! loginParams.idToken.isNullOrEmpty()) " sfa" else " "
461481 )
482+
483+ val analyticsProps = mutableMapOf<String , Any >(
484+ " connector" to " auth" ,
485+ " auth_connection" to loginParams.authConnection,
486+ " auth_connection_id" to loginParams.authConnectionId.toString(),
487+ " group_auth_connection_id" to loginParams.groupedAuthConnectionId.toString(),
488+ " chain_id" to web3AuthOption.defaultChainId.toString(),
489+ " dapp_url" to loginParams.dappUrl.toString(),
490+ " chain_id" to web3AuthOption.defaultChainId.toString(),
491+ " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
492+ " auth_ux_mode" to " popup" ,
493+ )
494+
462495 if (loginParams.idToken.isNullOrEmpty()) {
463496 AnalyticsManager .trackEvent(
464497 AnalyticsEvents .CONNECTION_STARTED ,
465- mutableMapOf<String , Any >(
466- " chain_id" to web3AuthOption.defaultChainId.toString(),
467- " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
498+ analyticsProps + mutableMapOf<String , Any >(
468499 " is_sfa" to false ,
469500 )
470501 )
@@ -483,9 +514,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
483514 SharedPrefsHelper .putBoolean(IS_SFA , true )
484515 AnalyticsManager .trackEvent(
485516 AnalyticsEvents .CONNECTION_STARTED ,
486- mutableMapOf<String , Any >(
487- " chain_id" to web3AuthOption.defaultChainId.toString(),
488- " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
517+ analyticsProps + mutableMapOf<String , Any >(
489518 " is_sfa" to true ,
490519 )
491520 )
@@ -713,7 +742,13 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
713742 fun enableMFA (loginParams : LoginParams ? = null): CompletableFuture <Boolean > {
714743 actionType = " enable_mfa"
715744 AnalyticsManager .trackEvent(
716- AnalyticsEvents .MFA_ENABLEMENT_STARTED
745+ AnalyticsEvents .MFA_ENABLEMENT_STARTED ,
746+ mutableMapOf<String , Any >(
747+ " integration_type" to " android" ,
748+ " dapp_url" to this .loginParams?.dappUrl.toString(),
749+ " connector" to " auth" ,
750+ " duration" to System .currentTimeMillis() - startTime,
751+ )
717752 )
718753 enableMfaCompletableFuture = CompletableFuture ()
719754 if (web3AuthResponse?.userInfo?.isMfaEnabled == true ) {
@@ -733,7 +768,12 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
733768 fun manageMFA (loginParams : LoginParams ? = null): CompletableFuture <Boolean > {
734769 actionType = " manage_mfa"
735770 AnalyticsManager .trackEvent(
736- AnalyticsEvents .MFA_MANAGEMENT_SELECTED
771+ AnalyticsEvents .MFA_MANAGEMENT_SELECTED ,
772+ mutableMapOf<String , Any >(
773+ " integration_type" to " android" ,
774+ " dapp_url" to this .loginParams?.dappUrl.toString(),
775+ " connector" to " auth"
776+ )
737777 )
738778 manageMfaCompletableFuture = CompletableFuture ()
739779 if (web3AuthResponse?.userInfo?.isMfaEnabled == false ) {
@@ -885,7 +925,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
885925 path : String? = "wallet",
886926 ): CompletableFuture <Void > {
887927 AnalyticsManager .trackEvent(
888- AnalyticsEvents .WALLET_SERVICES_STARTED
928+ AnalyticsEvents .WALLET_UI_CLICKED
889929 )
890930 val launchWalletServiceCF: CompletableFuture <Void > = CompletableFuture ()
891931 val savedSessionId = SessionManager .getSessionIdFromStorage()
@@ -1186,6 +1226,15 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
11861226 }
11871227
11881228 val properties = mapOf (
1229+ " connector" to " auth" ,
1230+ " auth_connection" to loginParams?.authConnection,
1231+ " auth_connection_id" to loginParams?.authConnectionId.toString(),
1232+ " group_auth_connection_id" to loginParams?.groupedAuthConnectionId.toString(),
1233+ " chain_id" to web3AuthOption.defaultChainId.toString(),
1234+ " dapp_url" to loginParams?.dappUrl.toString(),
1235+ " chain_id" to web3AuthOption.defaultChainId.toString(),
1236+ " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
1237+ " auth_ux_mode" to " popup" ,
11891238 " duration" to System .currentTimeMillis() - startTime,
11901239 " error_message" to (error?.name ? : " Unknown Error" )
11911240 )
@@ -1200,7 +1249,20 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
12001249 else -> AnalyticsEvents .MFA_MANAGEMENT_COMPLETED
12011250 }
12021251
1203- val properties = mapOf (" duration" to System .currentTimeMillis() - startTime)
1252+ val analyticsProps = mutableMapOf<String , Any >(
1253+ " connector" to " auth" ,
1254+ " auth_connection" to loginParams?.authConnection.toString(),
1255+ " auth_connection_id" to loginParams?.authConnectionId.toString(),
1256+ " group_auth_connection_id" to loginParams?.groupedAuthConnectionId.toString(),
1257+ " chain_id" to web3AuthOption.defaultChainId.toString(),
1258+ " dapp_url" to loginParams?.dappUrl.toString(),
1259+ " chain_id" to web3AuthOption.defaultChainId.toString(),
1260+ " chains" to (web3AuthOption.chains?.toString() ? : " []" ),
1261+ " integration_type" to " android" ,
1262+ " is_mfa_enabled" to (actionType == " enable_mfa" ),
1263+ )
1264+ val properties =
1265+ analyticsProps + mapOf (" duration" to System .currentTimeMillis() - startTime)
12041266
12051267 AnalyticsManager .trackEvent(event, properties)
12061268 }
0 commit comments