PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.6.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.6.1
1.6.1 1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
← All changes | inc/admin/analytics.php +60 -4 1.5.0 → 1.6.1 View file →
@@ -8,8 +8,9 @@
8 8 namespace SureDonation\Inc\Admin;
9 9
10 10 use SureDonation\Inc\Campaign_Templates\Campaign_Templates;
11 11 use SureDonation\Inc\Campaigns\Campaign_Cpt;
12 +use SureDonation\Inc\Emails\Email_Reports;
12 13 use SureDonation\Inc\Helper;
13 14 use SureDonation\Inc\Payments\Offline\Offline_Helper;
14 15 use SureDonation\Inc\Payments\Payment_Helper;
15 16 use SureDonation\Inc\Payments\PayPal\PayPal_Helper;
@@ -42,12 +43,37 @@
42 43 * @var array<string, string>
43 44 * @since 1.3.0
44 45 */
45 46 public const TRACKED_EVENTS = [
46 - 'configure_gateway' => 'configure_gateway_notice_react_cta',
47 - 'webhook' => 'webhook_notice_react_cta',
48 - 'test_mode' => 'test_mode_notice_react_cta',
49 - 'quick_access' => 'quick_access_configure_gateway_react_cta',
47 + 'configure_gateway' => 'configure_gateway_notice_react_cta',
48 + 'webhook' => 'webhook_notice_react_cta',
49 + 'test_mode' => 'test_mode_notice_react_cta',
50 + 'quick_access' => 'quick_access_configure_gateway_react_cta',
51 + // The PayPal settings panel warns when PayPal has told us the connected
52 + // account cannot be paid. The CTA sends the merchant to PayPal to finish
53 + // setup; the dismiss says they saw it and moved on, which is worth
54 + // separating from never having seen it.
55 + 'paypal_account' => 'paypal_account_warning_react_cta',
56 + 'paypal_account_x' => 'paypal_account_warning_react_dismiss',
57 + 'paypal_webhook_x' => 'paypal_webhook_error_react_dismiss',
58 + // The Stripe settings panel warns when Stripe has told us the connected
59 + // account cannot charge cards. The CTA sends the site owner to their
60 + // Stripe dashboard to resolve it; the dismiss says they saw it and moved
61 + // on, which is worth separating from never having seen it.
62 + 'stripe_account' => 'stripe_account_warning_react_cta',
63 + 'stripe_account_x' => 'stripe_account_warning_react_dismiss',
64 + // The form-side capability notices link here with ?sd_notice=, so the
65 + // settings screen records that one of them is what brought the admin
66 + // over. Their own page is a public donation form, which is no place to
67 + // be loading a tracker.
68 + 'stripe_capability' => 'stripe_capability_notice_cta',
69 + // The other three donation-form notices reach the settings screen the
70 + // same way. Their own page is a public donation form, which is no place
71 + // to be loading a tracker, so the CTA carries a marker and the arrival
72 + // is what gets recorded.
73 + 'frontend_test_mode' => 'frontend_test_mode_notice_cta',
74 + 'frontend_gateway_unavailable' => 'frontend_gateway_unavailable_notice_cta',
75 + 'frontend_gateway_setup' => 'frontend_gateway_setup_notice_cta',
50 76 ];
51 77
52 78 /**
53 79 * BSF_Analytics_Events instance for one-time event tracking.
@@ -284,8 +310,10 @@
284 310 : 'self';
285 311
286 312 $privacy_settings = Privacy_Settings::get_settings();
287 313
314 + $email_reports_settings = Email_Reports::get_settings();
315 +
288 316 // Computed once: the headline total below is derived from the same rows.
289 317 $template_usage = $this->get_campaign_template_usage();
290 318
291 319 $plugin_data = [
@@ -322,8 +350,13 @@
322 350 'ottokit_connected' => Helper::is_suretriggers_ready(),
323 351 'contact_consent_enabled' => ! empty( $privacy_settings['contact_consent_field'] ),
324 352 'privacy_policy_field_enabled' => ! empty( $privacy_settings['privacy_policy_field'] ),
325 353 'terms_field_enabled' => ! empty( $privacy_settings['terms_conditions_field'] ),
354 + // Scheduled sends only go out in live mode, so read this
355 + // against the payment_mode already on the KPI records to tell
356 + // sites actually receiving a report from sites where it is on
357 + // but paused.
358 + 'email_reports_enabled' => ! empty( $email_reports_settings['enabled'] ),
326 359 ],
327 360 'data_retention_period' => isset( $privacy_settings['minimum_data_retention_period'] ) ? Helper::get_string_value( $privacy_settings['minimum_data_retention_period'] ) : 'none',
328 361 'block_usage' => $this->get_block_usage(),
329 362 'campaign_template_usage' => $template_usage,
@@ -696,8 +729,9 @@
696 729 'campaign_goal' => 'suredonation/campaign-goal',
697 730 'campaign_stats' => 'suredonation/campaign-stats',
698 731 'campaign_donations' => 'suredonation/campaign-donations',
699 732 'campaign_donors' => 'suredonation/campaign-donors',
733 + 'campaign_donor_comments' => 'suredonation/campaign-donor-comments',
700 734 'campaign_donate_button' => 'suredonation/campaign-donate-button',
701 735 'campaign_social_sharing' => 'suredonation/campaign-social-sharing',
702 736 'donation_form' => 'suredonation/donation-form',
703 737 ];
@@ -821,8 +855,9 @@
821 855 'campaign_goal' => 'suredonation-campaign-goal',
822 856 'campaign_stats' => 'suredonation-campaign-stats',
823 857 'campaign_donations' => 'suredonation-campaign-donations',
824 858 'campaign_donors' => 'suredonation-campaign-donors',
859 + 'campaign_donor_comments' => 'suredonation-campaign-donor-comments',
825 860 'campaign_donate_button' => 'suredonation-campaign-donate-button',
826 861 'campaign_social_sharing' => 'suredonation-campaign-social-sharing',
827 862 'donation_form' => 'suredonation-donation-form',
828 863 ];
@@ -875,8 +910,9 @@
875 910 'campaign_goal' => 'suredonation-campaign-goal',
876 911 'campaign_stats' => 'suredonation-campaign-stats',
877 912 'campaign_donations' => 'suredonation-campaign-donations',
878 913 'campaign_donors' => 'suredonation-campaign-donors',
914 + 'campaign_donor_comments' => 'suredonation-campaign-donor-comments',
879 915 'campaign_donate_button' => 'suredonation-campaign-donate-button',
880 916 'campaign_social_sharing' => 'suredonation-campaign-social-sharing',
881 917 'donation_form' => 'suredonation-donation-form',
882 918 ];
@@ -1110,8 +1146,28 @@
1110 1146
1111 1147 // stripe_connected: detect connection state.
1112 1148 if ( Stripe_Helper::is_stripe_connected() ) {
1113 1149 $events->track( 'stripe_connected', $mode );
1150 + }
1151 +
1152 + // stripe_card_capability_blocked: connected but Stripe will not let the
1153 + // account charge cards, so the card form is hidden and donations are
1154 + // being lost or diverted. Detected here rather than where the notices
1155 + // render: this is site state, not a page event, and the render path is
1156 + // a public request that should not be paying for analytics.
1157 + $blocked_accounts = 0;
1158 + foreach ( array_keys( Stripe_Helper::get_all_accounts() ) as $blocked_candidate ) {
1159 + if ( Stripe_Helper::is_card_capability_blocked( (string) $blocked_candidate, $mode ) ) {
1160 + ++$blocked_accounts;
1161 + }
1162 + }
1163 +
1164 + if ( $blocked_accounts > 0 ) {
1165 + $events->track(
1166 + 'stripe_card_capability_blocked',
1167 + $mode,
1168 + [ 'blocked_accounts' => $blocked_accounts ]
1169 + );
1114 1170 }
1115 1171
1116 1172 // paypal_connected: detect connection state.
1117 1173 if ( PayPal_Helper::is_paypal_connected() ) {