woocommerce/plugins/woocommerce-admin/client/customize-store/tracking/index.ts

29 lines
601 B
TypeScript
Raw Normal View History

/**
* External dependencies
*/
import { recordEvent } from '@woocommerce/tracks';
/**
* Internal dependencies
*/
import {
ENTREPRENEUR_FLOW_QUERY_PARAM_VALUE,
isEntrepreneurFlow,
} from '~/customize-store/design-with-ai/entrepreneur-flow';
import { isWooExpress } from '~/utils/is-woo-express';
export const trackEvent = (
eventName: string,
properties?: Record< string, unknown >
) => {
if ( isWooExpress() && isEntrepreneurFlow() ) {
recordEvent( eventName, {
...properties,
ref: ENTREPRENEUR_FLOW_QUERY_PARAM_VALUE,
} );
return;
}
recordEvent( eventName, properties );
};