29 lines
601 B
TypeScript
29 lines
601 B
TypeScript
|
/**
|
||
|
* 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 );
|
||
|
};
|