File size: 920 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 25 26 27 28 |
import {
initializeAnalytics as initializeCalypsoAnalytics,
getTracksAnonymousUserId,
getCurrentUser,
} from '@automattic/calypso-analytics';
import debugModule from 'debug';
/**
* Module variables
*/
const debug = debugModule( 'calypso:analytics:init' );
export async function initializeAnalytics( currentUser, superProps ) {
await initializeCalypsoAnalytics( currentUser, superProps );
const user = getCurrentUser();
// This block is necessary because calypso-analytics/initializeAnalytics no longer calls out to ad-tracking
if ( 'object' === typeof currentUser && user && getTracksAnonymousUserId() ) {
const mod = await import(
/* webpackChunkName: "lib-analytics-ad-tracking-record-alias-in-floodlight" */
'calypso/lib/analytics/ad-tracking/record-alias-in-floodlight'
);
const { recordAliasInFloodlight } = mod;
debug( 'recordAliasInFloodlight', user );
recordAliasInFloodlight();
}
}
|