Merge pull request #7386 from woothemes/tracking-duplicate-optins
Tracking duplicate optins
This commit is contained in:
commit
1eb29d0acf
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* WooCommerce Notices JS
|
||||
*/
|
||||
jQuery( function ( $ ) {
|
||||
|
||||
$('.woocommerce-tracker .button-primary').on('click',function() {
|
||||
$('.woocommerce-tracker' ).slideUp();
|
||||
});
|
||||
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
jQuery(function(a){a(".woocommerce-tracker .button-primary").on("click",function(){a(".woocommerce-tracker").slideUp()})});
|
|
@ -89,6 +89,7 @@ class WC_Admin_Assets {
|
|||
wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable' ), WC_VERSION );
|
||||
wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/admin/jquery.qrcode.min.js', array( 'jquery' ), WC_VERSION );
|
||||
wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
wp_register_script( 'woocommerce_admin_notices', WC()->plugin_url() . '/assets/js/admin/woocommerce_notices' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
|
||||
// Chosen is @deprecated (2.3) in favour of select2, but is registered for backwards compat
|
||||
wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array( 'jquery', 'chosen' ), WC_VERSION );
|
||||
|
@ -122,6 +123,9 @@ class WC_Admin_Assets {
|
|||
'mon_decimal_point' => wc_get_price_decimal_separator()
|
||||
) );
|
||||
|
||||
// WooCommerce admin notices script should be included on all pages as notices show on any admin page.
|
||||
wp_enqueue_script( 'woocommerce_admin_notices' );
|
||||
|
||||
// WooCommerce admin pages
|
||||
if ( in_array( $screen->id, wc_get_screen_ids() ) ) {
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<div id="message" class="updated woocommerce-message woocommerce-tracker">
|
||||
<p><?php printf( __( 'Want to help make WooCommerce even more awesome? Allow WooThemes to collect non-sensitive diagnostic data and usage information, and get %s discount on your next WooThemes purchase. %sFind out more%s.', 'woocommerce' ), '20%', '<a href="http://www.woothemes.com/woocommerce/usage-tracking/" target="_blank">', '</a>' ); ?></p>
|
||||
<p class="submit">
|
||||
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optin', 'true' ), 'wc_tracker_optin', 'wc_tracker_nonce' ) ); ?>" class="button-primary"><?php _e( 'Allow', 'woocommerce' ); ?></a>
|
||||
<a class="button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc_tracker_optin', 'true' ), 'wc_tracker_optin', 'wc_tracker_nonce' ) ); ?>"><?php _e( 'Allow', 'woocommerce' ); ?></a>
|
||||
<a class="skip button" href="<?php echo esc_url( add_query_arg( 'wc-hide-notice', 'tracking' ) ); ?>"><?php _e( 'No, do not bother me again', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -43,6 +43,12 @@ class WC_Tracker {
|
|||
if ( $last_send && $last_send > apply_filters( 'woocommerce_tracker_last_send_interval', strtotime( '-1 week' ) ) ) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Make sure there is at least a 10 minute delay between override sends, we dont want duplicate calls due to double clicking links.
|
||||
$last_send = self::get_last_send_time();
|
||||
if ( $last_send && $last_send > strtotime( '-10 minutes' ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$params = self::get_tracking_data();
|
||||
|
|
Loading…
Reference in New Issue