@@ -154,6 +154,7 @@ public final class KSRAnalytics {
154154 case logInOrSignUp
155155 case logInSubmit
156156 case messageCreatorInitiate
157+ case nativeManagePledge
157158 case pledgeConfirm
158159 case pledgeInitiate
159160 case pledgeSubmit
@@ -193,6 +194,7 @@ public final class KSRAnalytics {
193194 case . fixPledgeInitiate: return " fix_pledge_initiate "
194195 case . forgotPassword: return " forgot_password "
195196 case . messageCreatorInitiate: return " message_creator_initiate "
197+ case . nativeManagePledge: return " native_manage_pledge "
196198 case . onboardingClose: return " close "
197199 case . onboardingNext: return " next "
198200 case . onboardingGetNotified: return " get_notified "
@@ -573,7 +575,8 @@ public final class KSRAnalytics {
573575 let paymentFailedCount : Int
574576 let cardAuthRequiredCount : Int
575577 let fundedProjectCount : Int
576- let total : Int ?
578+ let liveProjectCount : Int
579+ let unsuccessfulPledgeCount : Int
577580 let page : Int ?
578581
579582 var alertCardCount : Int {
@@ -584,14 +587,24 @@ public final class KSRAnalytics {
584587 self . cardAuthRequiredCount
585588 }
586589
590+ // Calculate the total number of cards that have been fetched.
591+ // This ensures the total count is consistent with other counts.
592+ var total : Int {
593+ return self . alertCardCount +
594+ self . fundedProjectCount +
595+ self . liveProjectCount +
596+ self . unsuccessfulPledgeCount
597+ }
598+
587599 public init (
588600 addressLocksSoonCount: Int ,
589601 surveyAvailableCount: Int ,
590602 pledgeManagementCount: Int ,
591603 paymentFailedCount: Int ,
592604 cardAuthRequiredCount: Int ,
593605 fundedProjectCount: Int ,
594- total: Int ? ,
606+ liveProjectCount: Int ,
607+ unsuccessfulPledgeCount: Int ,
595608 page: Int ?
596609 ) {
597610 self . addressLocksSoonCount = addressLocksSoonCount
@@ -600,7 +613,8 @@ public final class KSRAnalytics {
600613 self . paymentFailedCount = paymentFailedCount
601614 self . cardAuthRequiredCount = cardAuthRequiredCount
602615 self . fundedProjectCount = fundedProjectCount
603- self . total = total
616+ self . liveProjectCount = liveProjectCount
617+ self . unsuccessfulPledgeCount = unsuccessfulPledgeCount
604618 self . page = page
605619 }
606620 }
@@ -802,6 +816,23 @@ public final class KSRAnalytics {
802816 )
803817 }
804818
819+ public func trackPPOManageLivePledge(
820+ project: any ProjectAnalyticsProperties ,
821+ properties: PledgedProjectOverviewProperties
822+ ) {
823+ let props = contextProperties (
824+ ctaContext: . nativeManagePledge,
825+ page: . projectAlerts
826+ )
827+ . withAllValuesFrom ( projectProperties ( from: project) )
828+ . withAllValuesFrom ( pledgedProjectOverviewProperties ( from: properties) )
829+
830+ self . track (
831+ event: SegmentEvent . ctaClicked. rawValue,
832+ properties: props
833+ )
834+ }
835+
805836 public func trackPPOViewProjectDetails(
806837 project: any ProjectAnalyticsProperties ,
807838 properties: PledgedProjectOverviewProperties
@@ -1762,11 +1793,10 @@ private func pledgedProjectOverviewProperties(
17621793
17631794 result [ " notification_count_alert_card " ] = properties. alertCardCount
17641795 result [ " notification_count_funded_project " ] = properties. fundedProjectCount
1796+ result [ " notification_count_live_project " ] = properties. liveProjectCount
1797+ result [ " notification_count_unsuccessful_pledge " ] = properties. unsuccessfulPledgeCount
17651798
1766- if let total = properties. total {
1767- result [ " notification_count_total " ] = total
1768- }
1769-
1799+ result [ " notification_count_total " ] = properties. total
17701800 if let page = properties. page {
17711801 result [ " context_page_number " ] = page
17721802 }
0 commit comments