fevicon_url = get_site_icon_url(75); } public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self(); } return self::$instance; } /* Dashboard stats */ public $awca_dash_stats = array( 'Total Revenue', 'Total Transctions', 'Conversion Rate', 'Total Users', 'Avg Session Duration', 'Bounce Rate', 'Avg Transction Revenue', 'Avg Pageload Time' ); /* Dashboard stats */ public $awca_dash_stats_ga4 = array( 'Total Revenue', 'Total Transctions', 'Conversion Rate', 'Total Users', 'Engagement Duration', 'Engagement Rate', 'Avg Transction Revenue', 'Engaged sessions' ); /* Dashboard settings */ public $awca_dash_settings = array( 'report_view'=>'', 'report_frame'=>'Last 30 days', 'report_from'=>'', 'report_to'=>'', ); /* Authentication Settings */ public $awca_auth_settings = array( 'trackind_id' => '', 'property_id' => '', 'api_secret' => '', 'manual_tracking' => false, 'agreement'=> true, ); /* Tracking Settings */ public $awca_tracking_settings = array( 'track_admin' => true, 'not_track_pageviews' => false, 'anonymize_ip'=> true, 'disable_on_hold_conversion' => true, 'gdpr_enable' => false, 'gdpr_title' => 'Help us to serve you better!', 'gdpr_subtitle' => 'We use your shopping experience data to improve our services.', 'gdpr_image_url' => '', 'gdpr_opt_in_name' => 'Yes', 'gdpr_opt_out_name' => 'No', ); /* parsing tracking settings before saving them */ public function parse_awca_track_settings($settings) { $args = array( 'track_admin' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'not_track_pageviews' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'anonymize_ip' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'disable_on_hold_conversion' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_enable' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_pos_right' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_title' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_subtitle' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_image_url' => array( 'filter' => FILTER_SANITIZE_URL, ), 'gdpr_opt_in_name' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_opt_out_name' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), ); $settings = filter_var_array( $settings, $args ); return $settings; } /* Event Tracking Settings */ public $awca_event_settings = array( 'user_login' => true, 'user_logout' => true, 'viewed_signup_form' => true, 'user_signup' => true, 'viewed_shop' => true, 'viewed_product' => true, 'begin_checkout' => true, 'filled_checkout_form' => true, 'added_payment_method' => true, 'added_shipping_method' => true, 'order_failed' => true, 'processing_payment' => true, 'completed_purchase' => true, 'wrote_review' => true, 'commented' => true, 'viewed_account' => true, ); /* Hooks Associated with events */ public $awca_event_hooks = array( 'user_login' => array(2,'wp_login'), 'user_logout' => 'wp_logout', 'viewed_signup_form' => 'woocommerce_register_form', 'user_signup' => 'user_register', 'viewed_shop' => 'wp_head', 'viewed_product' => 'woocommerce_after_single_product_summary', 'begin_checkout' => 'woocommerce_after_checkout_form', 'filled_checkout_form' => 'woocommerce_after_checkout_form', 'added_shipping_method' => 'woocommerce_after_checkout_form', 'added_payment_method' => 'woocommerce_after_checkout_form', 'order_failed' => array(2,'woocommerce_order_status_failed'), 'processing_payment' => 'woocommerce_checkout_order_processed', 'completed_purchase' => array('woocommerce_order_status_on-hold','woocommerce_payment_complete','woocommerce_order_status_processing','woocommerce_order_status_completed','woocommerce_thankyou'), 'wrote_review' => 'comment_post', 'commented' => 'comment_post', 'viewed_account' => 'woocommerce_after_my_account', ); /* parsing Authentication settings before saving them */ public function parse_awca_auth_settings($settings) { $args = array( 'tracking_id' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'property_id' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'api_secret' => array( 'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS, 'flags' => FILTER_REQUIRE_SCALAR, ), 'manual_tracking' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'agreement' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), ); $settings = filter_var_array( $settings, $args ); return $settings; } /* parsing event settings before saving them */ public function parse_awca_bool_settings($settings) { $settings = filter_var_array( $settings,FILTER_VALIDATE_BOOLEAN ); return $settings; } /* parsing dash settings before saving them */ public function parse_awca_dash_settings($settings) { $settings = filter_var_array( $settings,FILTER_SANITIZE_FULL_SPECIAL_CHARS ); return $settings; } public $awca_report_request_dash = array( 'stats'=>array(), 'productPerformance' => array('itemRevenue','productName','itemRevenue'), 'sourceBaseRevenue' => array('transactionRevenue','sourceMedium','transactionRevenue'), 'deviceBaseRevenue' => array('transactionRevenue','deviceCategory','transactionRevenue'), 'regionBaseRevenue' => array('transactionRevenue','region','transactionRevenue'), ); public $awca_report_chart_data_dash = array( 'stats'=>array(), 'productPerformance' => array('bar','Product Base Revenue Report','Product Name','Product Revenue'), 'sourceBaseRevenue' => array('bar','Source Base Revenue Report','Traffic Source/Medium','Total Revenue'), 'deviceBaseRevenue' => array('pie','Device base conversion share','',''), 'regionBaseRevenue' => array('bar','State/Region Base Revenue Report','State/Region Name','Total Revenue'), ); public $awca_dash_stats_data_dash = array( 'transactionRevenue'=>array('payments','Total Revenue','money',true), 'transactions'=>array('receipt_long','Total Transctions','',false), 'transactionsPerSession'=>array('alarm_on','Conversion Rate','%',false), 'users'=>array('people_alt','Users','',true), 'avgSessionDuration'=>array('timer','Avg Session Duration','s',false), 'bounceRate'=>array('timeline','Bounce Rate','%',false), 'revenuePerTransaction'=>array('receipt','Avg Transction Revenue','money',true), 'avgPageLoadTime'=>array('restart_alt','Avg Pageload Time','s',false), ); public $awca_report_request_ga4_dash = array( 'stats'=>array(), 'productPerformance' => array('itemRevenue','itemName','itemRevenue'), 'sourceBaseRevenue' => array('totalRevenue','sessionSource','totalRevenue'), 'deviceBaseRevenue' => array('totalRevenue','deviceCategory','totalRevenue'), 'regionBaseRevenue' => array('totalRevenue','region','totalRevenue'), ); public $awca_report_chart_data_ga4_dash = array( 'stats'=>array(), 'productPerformance' => array('bar','Product Base Revenue Report','Product Name','Product Revenue'), 'sourceBaseRevenue' => array('bar','Source Base Revenue Report','Traffic Source/Medium','Total Revenue'), 'deviceBaseRevenue' => array('pie','Device base conversion share','',''), 'regionBaseRevenue' => array('bar','State/Region Base Revenue Report','State/Region Name','Total Revenue'), ); public $awca_dash_stats_data_ga4_dash = array( 'purchaseRevenue'=>array('payments','Total Revenue','money',true), 'transactions'=>array('receipt_long','Total Transctions','',false), 'totalUsers'=>array('people_alt','Users','',false), 'averagePurchaseRevenue'=>array('receipt','Revenue/Transaction','money',true), ); /* Defining Defaults for Dashboard settings */ public function init_awca_dash_defaults() { $defaults = array( 'report_view'=>'', 'report_frame'=>'Last 30 days', 'report_from'=>'', 'report_to'=>'', ); return $defaults; } /* Defining Defaults for Authentication Settings */ public function init_awca_auth_defaults() { $defaults = array( 'trackind_id' => '', 'property_id' => '', 'api_secret' =>'', 'manual_tracking' => false, 'agreement'=> true, ); return $defaults; } /* Defining Defaults for Tracking Settings */ public function init_awca_track_defaults() { $defaults = array( 'track_admin' => true, 'not_track_pageviews' => false, 'anonymize_ip'=> true, 'disable_on_hold_conversion' => true, 'gdpr_enable' => false, 'gdpr_title' => 'Help us to serve you better!', 'gdpr_subtitle' => 'We use your shopping experience data to improve our services.', 'gdpr_image_url' => $this->fevicon_url, 'gdpr_opt_in_name' => 'Yes', 'gdpr_opt_out_name' => 'No', ); return $defaults; } /* Defining Defaults for Events Settings */ public function init_awca_events_defaults() { $defaults = array( 'user_login' => true, 'user_logout' => true, 'viewed_signup_form' => true, 'user_signup' => true, 'viewed_shop' => true, 'viewed_product' => true, 'begin_checkout' => true, 'filled_checkout_form' => true, 'added_payment_method' => true, 'added_shipping_method' => true, 'order_failed' => true, 'processing_payment' => true, 'completed_purchase' => true, 'wrote_review' => true, 'commented' => true, 'viewed_account' => true, ); return $defaults; } }