Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • Docs Home

Packages

  • Abandoned-Cart-Lite-for-WooCommerce
    • Admin
      • Admin-Action
      • Admin-Notice
      • Component
      • Default-Template
      • List-Class
      • Tracking-Data
      • Welcome-Page
    • Common-Functions
    • Core
    • Cron
    • Encrypt-Decrypt-Data
    • Frontend
      • Capture-Guest-Cart
    • Tracking
    • Uninstaller
  • None

Classes

  • Class_Wcal_Ts_Tracker
  • TS_deactivate
  • TS_Faq_Support
  • ts_pro_notices
  • TS_Tracker
  • TS_tracking
  • TS_Welcome
  • TS_Woo_Active
  • WCAL_Abandoned_Orders_Table
  • Wcal_Admin_Notice
  • Wcal_Aes
  • Wcal_Aes_Ctr
  • Wcal_All_Component
  • wcal_common
  • wcal_default_template_settings
  • wcal_delete_bulk_action_handler
  • Wcal_Personal_Data_Eraser
  • Wcal_Personal_Data_Export
  • WCAL_Product_Report_Table
  • wcal_Recover_Orders_Table
  • WCAL_Templates_Table
  • Wcal_Tracking_msg
  • Wcal_TS_Tracking
  • Wcal_Welcome
  • woocommerce_abandon_cart_lite
  • woocommerce_guest_ac

Functions

  • guest_checkout_fields
  • load_ac_ajax
  • save_data
  • user_side_js
  • wcal_add_cron_schedule
  • wcal_send_email_cron
  • woocommerce_ac_delete_lite
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 
<?php
/**
 * Abandoned Cart Lite for WooCommerce
 *
 * It will manage the tracking of the plugin data.
 *
 * @author  Tyche Softwares
 * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
 */
 
include_once( 'classes/class-wcal-ts-tracker.php' );

/**
 * It will have all the data for tracking the data.
 * @since 3.9
 */
class Wcal_TS_Tracking {
    /**
     * It will add all the necessary action for tracking the data.
     * @since 3.9
     */
    public function __construct() {
        //Tracking Data
        add_action( 'admin_notices',               array( &$this, 'wcal_track_usage_data' ), 10 );
        add_action( 'admin_footer',                array( &$this, 'wcal_admin_notices_scripts' ) );
        add_action( 'wp_ajax_wcal_admin_notices',  array( &$this, 'wcal_admin_notices' ) );
    }

    /**
     * It will add the js for dismissible notice.
     * @since 3.9
     */
    public static function wcal_admin_notices_scripts() {
        wp_enqueue_script( 'wcal_admin_dismissal_notice', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js' );
    }

    /**
     * It will the admin notice.
     * @since 3.9
     */
    public static function wcal_admin_notices() {
        Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
        update_option( 'wcal_allow_tracking', 'dismissed' );
        die();
    }

    /**
     * It will check the selected admin action it will be either allow or not allow.
     * @since 3.9
     */
    private function wcal_ts_tracking_actions() {

        if ( isset( $_GET[ 'wcal_tracker_optin' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optin' ) ) {
            update_option( 'wcal_allow_tracking', 'yes' );
            Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( true );
            header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
        } elseif ( isset( $_GET[ 'wcal_tracker_optout' ] ) && isset( $_GET[ 'wcal_tracker_nonce' ] ) && wp_verify_nonce( $_GET[ 'wcal_tracker_nonce' ], 'wcal_tracker_optout' ) ) {
            update_option( 'wcal_allow_tracking', 'no' );
            Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
            header( 'Location: ' . $_SERVER[ 'HTTP_REFERER' ] );
        }
    }

    /**
     * It will add the notice on the admin side.
     * @since 3.9
     */
    function wcal_track_usage_data() {
        $wcal_admin_url = get_admin_url();
        echo '<input type="hidden" id="admin_url" value="' . $wcal_admin_url . '"/>';
        $this->wcal_ts_tracking_actions();
        if ( 'unknown' === get_option( 'wcal_allow_tracking', 'unknown' ) ) : ?>
            <div class="wcal-message wcal-tracker notice notice-info is-dismissible" style="position: relative;">
                <div style="position: absolute;"><img class="site-logo" src="<?php echo plugins_url(); ?>/woocommerce-abandoned-cart/assets/images/site-logo-new.jpg"></div>
                <p style="margin: 10px 0 10px 130px; font-size: medium;">
                    <?php print( __( 'Want to help make Abandoned Cart even more awesome? Allow Abandoned Cart to collect non-sensitive diagnostic data and usage information and get 20% off on your next purchase. <a href="https://www.tychesoftwares.com/abandoned-cart-lite-usage-tracking/" target="_blank">Find out more</a>. <br><br>', 'woocommerce-abandoned-cart' ) ); ?></p>
                <p class="submit">
                    <a class="button-primary button button-large" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcal_tracker_optin', 'true' ), 'wcal_tracker_optin', 'wcal_tracker_nonce' ) ); ?>"><?php esc_html_e( 'Allow', 'woocommerce-abandoned-cart' ); ?></a>
                    <a class="button-secondary button button-large skip"  href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcal_tracker_optout', 'true' ), 'wcal_tracker_optout', 'wcal_tracker_nonce' ) ); ?>"><?php esc_html_e( 'No thanks', 'woocommerce-abandoned-cart' ); ?></a>
                </p>
            </div>
        <?php endif;
    }
}
$TS_tracking = new Wcal_TS_Tracking();
API documentation generated by ApiGen