@@ -583,5 +583,42 @@ public static BigInteger GweiToWei(double gweiAmount)
583
583
{
584
584
return new BigInteger ( gweiAmount * 1e9 ) ;
585
585
}
586
+
587
+ public static async void TrackWalletAnalytics ( string clientId , string source , string action , string walletType , string walletAddress )
588
+ {
589
+ try
590
+ {
591
+ var body = new
592
+ {
593
+ source ,
594
+ action ,
595
+ walletAddress ,
596
+ walletType ,
597
+ } ;
598
+ var headers = new Dictionary < string , string >
599
+ {
600
+ { "x-client-id" , clientId } ,
601
+ { "x-sdk-platform" , "unity" } ,
602
+ { "x-sdk-name" , "UnitySDK" } ,
603
+ { "x-sdk-version" , ThirdwebSDK . version } ,
604
+ { "x-sdk-os" , GetRuntimePlatform ( ) } ,
605
+ { "x-bundle-id" , GetBundleId ( ) } ,
606
+ } ;
607
+ var request = new HttpRequestMessage ( HttpMethod . Post , "https://c.thirdweb.com/event" )
608
+ {
609
+ Content = new StringContent ( JsonConvert . SerializeObject ( body ) , Encoding . UTF8 , "application/json" )
610
+ } ;
611
+ foreach ( var header in headers )
612
+ {
613
+ request . Headers . Add ( header . Key , header . Value ) ;
614
+ }
615
+ using var client = new HttpClient ( ) ;
616
+ await client . SendAsync ( request ) ;
617
+ }
618
+ catch ( System . Exception e )
619
+ {
620
+ ThirdwebDebug . LogWarning ( $ "Failed to send wallet analytics: { e } ") ;
621
+ }
622
+ }
586
623
}
587
624
}
0 commit comments