client/lib/analytics/ad-tracking.js
function recordInCriteo( eventName, eventProps ) {
	if ( ! isAdTrackingAllowed() || ! isCriteoEnabled ) {
		debug( 'recordInCriteo: [Skipping] ad tracking is not allowed' );
		return;
	}

	if ( TRACKING_STATE_VALUES.LOADED !== trackingState ) {
		loadTrackingScripts( recordInCriteo.bind( null, eventName, eventProps ) );
		return;
	}

	const events = [];
	events.push( { event: 'setAccount', account: TRACKING_IDS.criteo } );
	events.push( { event: 'setSiteType', type: criteoSiteType() } );

	const normalizedHashedEmail = getNormalizedHashedUserEmail( user );
	if ( normalizedHashedEmail ) {
		events.push( { event: 'setEmail', email: [ normalizedHashedEmail ] } );
	}

	const conversionEvent = clone( eventProps );
	conversionEvent.event = eventName;
	events.push( conversionEvent );

	// The deep clone is necessary because the Criteo script modifies the objects in the
	// array which causes the console to display different data than is originally added
	debug( 'recordInCriteo: ' + eventName, cloneDeep( events ) );
	window.criteo_q.push( ...events );
}
function recordInCriteo( eventName, eventProps ) {
	if ( ! isAdTrackingAllowed() || ! isCriteoEnabled ) {
		debug( 'recordInCriteo: [Skipping] ad tracking is not allowed' );
		return;
	}

	if ( TRACKING_STATE_VALUES.LOADED !== trackingState ) {
		loadTrackingScripts( recordInCriteo.bind( null, eventName, eventProps ) );
		return;
	}

	const events = [];
	events.push( { event: 'setAccount', account: TRACKING_IDS.criteo } );
	events.push( { event: 'setSiteType', type: criteoSiteType() } );

	const normalizedHashedEmail = getNormalizedHashedUserEmail( user );
	if ( normalizedHashedEmail ) {
		events.push( { event: 'setEmail', email: [ normalizedHashedEmail ] } );
	}

	const conversionEvent = clone( eventProps );
	conversionEvent.event = eventName;
	events.push( conversionEvent );

	// The deep clone is necessary because the Criteo script modifies the objects in the
	// array which causes the console to display different data than is originally added
	debug( 'recordInCriteo: ' + eventName, cloneDeep( events ) );
	window.criteo_q.push( ...events );
}
function recordInCriteo ( eventName , eventProps ) { if ( ! isAdTrackingAllowed ( ) || ! isCriteoEnabled ) { debug ( 'recordInCriteo: [Skipping] ad tracking is not allowed' ) ; return ; } if ( TRACKING_STATE_VALUES . LOADED !== trackingState ) { loadTrackingScripts ( recordInCriteo . bind ( null , eventName , eventProps ) ) ; return ; } const events = [ ] ; events . push ( { event : 'setAccount' , account : TRACKING_IDS . criteo } ) ; events . push ( { event : 'setSiteType' , type : criteoSiteType ( ) } ) ; const normalizedHashedEmail = getNormalizedHashedUserEmail ( user ) ; if ( normalizedHashedEmail ) { events . push ( { event : 'setEmail' , email : [ normalizedHashedEmail ] } ) ; } const conversionEvent = clone ( eventProps ) ; conversionEvent . event = eventName ; events . push ( conversionEvent ) ; // The deep clone is necessary because the Criteo script modifies the objects in the // array which causes the console to display different data than is originally added debug ( 'recordInCriteo: ' + eventName , cloneDeep ( events ) ) ; window . criteo_q . push ( ... events ) ; }
Records an event in Criteo

@param {String} eventName - The name of the 'event' property such as 'viewItem' or 'viewBasket'
@param {Object} eventProps - Additional details about the event such as `{ item: '1' }`

@returns {void}
Records an event in Criteo