* Add CES survey for importing products

* Update readme and testing instructions
This commit is contained in:
Ilyas Foo 2021-03-11 17:55:59 +08:00 committed by GitHub
parent 6c097d7745
commit 5be293f5c8
3 changed files with 48 additions and 2 deletions

View File

@ -208,6 +208,17 @@ Scenario #2
- Go to Customers.
- Type in anything in search bar, and press enter.
- Observe CES prompt "How easy was it to use search?" is displayed
### Add CES survey for importing products #6419
- Make sure tracking is enabled in settings.
- Delete the option `woocommerce_ces_shown_for_actions` to make sure CES prompt triggers when updating settings.
- Enable the logging of Tracks events to your browser dev console `localStorage.setItem( 'debug', 'wc-admin:tracks' );`
- If you don't have a product CSV export, you can obtain a sample CSV [here](https://gist.githubusercontent.com/ilyasfoo/507f9579531cf4bf50fe4c0e9c48a23d/raw/05e47e6731471464c757e893c3f2d8a9b89453c0/product-export.csv).
- Go to Products > All Products.
- Click on "Import".
- Upload CSV file and finish the import process.
- Observe CES prompt "How easy was it to import products?" is displayed.
## 2.1.2
### Add Guards to "Deactivate Plugin" Note Handlers #6532

View File

@ -112,6 +112,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Dev: Add tilde (~) to represent client root directory for imports. #6517
- Add: Add Ireland to Square payment method #6559
- Add: CES survey for search product, order, customer #6420
- Add: CES survey for importing products #6419
== 2.1.0 3/10/2021 ==

View File

@ -35,7 +35,12 @@ class CustomerEffortScoreTracks {
const SETTINGS_CHANGE_ACTION_NAME = 'settings_change';
/**
* Action name for add product tags.
* Action name for import products.
*/
const IMPORT_PRODUCTS_ACTION_NAME = 'import_products';
/**
* Action name for search.
*/
const SEARCH_ACTION_NAME = 'ces_search';
@ -46,7 +51,6 @@ class CustomerEffortScoreTracks {
*/
private $onsubmit_label;
/**
* Constructor. Sets up filters to hook into WooCommerce.
*/
@ -93,6 +97,8 @@ class CustomerEffortScoreTracks {
);
add_action( 'load-edit.php', array( $this, 'run_on_load_edit_php' ), 10, 3 );
add_action( 'product_page_product_importer', array( $this, 'run_on_product_import' ), 10, 3 );
$this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce-admin' );
}
@ -242,6 +248,34 @@ class CustomerEffortScoreTracks {
update_option( self::CLEAR_CES_TRACKS_QUEUE_FOR_PAGE_OPTION_NAME, false );
}
/**
* Maybe enqueue the CES survey on product import, if step is done.
*/
public function run_on_product_import() {
// We're only interested in when the importer completes.
if ( empty( $_GET['step'] ) || 'done' !== $_GET['step'] ) { // phpcs:ignore CSRF ok.
return;
}
if ( $this->has_been_shown( self::IMPORT_PRODUCTS_ACTION_NAME ) ) {
return;
}
$this->enqueue_to_ces_tracks(
array(
'action' => self::IMPORT_PRODUCTS_ACTION_NAME,
'label' => __(
'How easy was it to import products?',
'woocommerce-admin'
),
'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'product_page_product_importer',
'adminpage' => 'product_page_product_importer',
'props' => (object) array(),
)
);
}
/**
* Enqueue the CES survey trigger for setting changes.
*/