File size: 618 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { startsWith } from 'lodash';
import { bumpStat } from 'calypso/state/analytics/actions';

export const recordTrack = ( tracks, debug ) => ( eventName, eventProperties ) => {
	if ( ! startsWith( eventName, 'calypso_woocommerce_' ) ) {
		debug( `invalid store track name: '${ eventName }', must start with 'calypso_woocommerce_'` );
		return;
	}

	debug( `track '${ eventName }': `, eventProperties || {} );

	tracks.recordTracksEvent( eventName, eventProperties );
};

export const bumpMCStat = ( debug ) => ( group, name ) => {
	debug( `stat bump ${ group }: ${ name }` );

	return bumpStat( group, name );
};