woocommerce/plugins/woocommerce-admin/client/wp-admin-scripts/product-tracking/product-new.ts

21 lines
404 B
TypeScript

/**
* External dependencies
*/
import { recordEvent } from '@woocommerce/tracks';
/**
* Internal dependencies
*/
import { addExitPageListener, initProductScreenTracks } from './shared';
const initTracks = () => {
recordEvent( 'product_add_view' );
};
if ( productScreen && productScreen.name === 'new' ) {
initTracks();
initProductScreenTracks();
addExitPageListener( 'product_add_view' );
}