File size: 689 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {
	identifyUser as baseIdentifyUser,
	getTracksAnonymousUserId,
	getCurrentUser,
} from '@automattic/calypso-analytics';
import debugModule from 'debug';
import { recordAliasInFloodlight } from 'calypso/lib/analytics/ad-tracking';

/**
 * Module variables
 */
const debug = debugModule( 'calypso:analytics:identifyUser' );

export function identifyUser( userData ) {
	baseIdentifyUser( userData );

	// neccessary because calypso-analytics/initializeAnalytics no longer calls out to ad-tracking
	const user = getCurrentUser();
	if ( 'object' === typeof userData && user && getTracksAnonymousUserId() ) {
		debug( 'recordAliasInFloodlight', user );
		recordAliasInFloodlight();
	}
}