function recordOrderInFacebook( cart, orderId, wpcomJetpackCartInfo ) {
	if ( ! isAdTrackingAllowed() || ! isFacebookEnabled ) {
		return;
	}

	/**
	 * We have made a conscious decision to ignore the 0 cost carts, such that these carts are not considered
	 * a conversion. We will analyze the results and make a final decision on this.
	 */
	if ( cart.total_cost < 0.01 ) {
		debug( 'recordOrderInFacebook: skipping due to a 0-value cart.' );
		return;
	}

	const currentUser = user.get();
	const userId = currentUser ? hashPii( currentUser.ID ) : 0;

	// WPCom

	if ( wpcomJetpackCartInfo.containsWpcomProducts ) {
		const params = [
			'trackSingle',
			TRACKING_IDS.facebookInit,
			'Purchase',
			{
				product_slug: wpcomJetpackCartInfo.wpcomProducts
					.map( product => product.product_slug )
					.join( ', ' ),
				value: wpcomJetpackCartInfo.wpcomCost,
				currency: cart.currency,
				user_id: userId,
				order_id: orderId,
			},
		];
		debug( 'recordOrderInFacebook: WPCom', params );
		window.fbq( ...params );
	}

	// Jetpack

	if ( wpcomJetpackCartInfo.containsJetpackProducts ) {
		const params = [
			'trackSingle',
			TRACKING_IDS.facebookJetpackInit,
			'Purchase',
			{
				product_slug: wpcomJetpackCartInfo.jetpackProducts
					.map( product => product.product_slug )
					.join( ', ' ),
				value: wpcomJetpackCartInfo.jetpackCost,
				currency: cart.currency,
				user_id: userId,
				order_id: orderId,
			},
		];
		debug( 'recordOrderInFacebook: Jetpack', params );
		window.fbq( ...params );
	}
}
function recordOrderInFacebook( cart, orderId, wpcomJetpackCartInfo ) {
	if ( ! isAdTrackingAllowed() || ! isFacebookEnabled ) {
		return;
	}

	
	if ( cart.total_cost < 0.01 ) {
		debug( 'recordOrderInFacebook: skipping due to a 0-value cart.' );
		return;
	}

	const currentUser = user.get();
	const userId = currentUser ? hashPii( currentUser.ID ) : 0;

	

	if ( wpcomJetpackCartInfo.containsWpcomProducts ) {
		const params = [
			'trackSingle',
			TRACKING_IDS.facebookInit,
			'Purchase',
			{
				product_slug: wpcomJetpackCartInfo.wpcomProducts
					.map( product => product.product_slug )
					.join( ', ' ),
				value: wpcomJetpackCartInfo.wpcomCost,
				currency: cart.currency,
				user_id: userId,
				order_id: orderId,
			},
		];
		debug( 'recordOrderInFacebook: WPCom', params );
		window.fbq( ...params );
	}

	

	if ( wpcomJetpackCartInfo.containsJetpackProducts ) {
		const params = [
			'trackSingle',
			TRACKING_IDS.facebookJetpackInit,
			'Purchase',
			{
				product_slug: wpcomJetpackCartInfo.jetpackProducts
					.map( product => product.product_slug )
					.join( ', ' ),
				value: wpcomJetpackCartInfo.jetpackCost,
				currency: cart.currency,
				user_id: userId,
				order_id: orderId,
			},
		];
		debug( 'recordOrderInFacebook: Jetpack', params );
		window.fbq( ...params );
	}
}
function recordOrderInFacebook ( cart , orderId , wpcomJetpackCartInfo ) { if ( ! isAdTrackingAllowed ( ) || ! isFacebookEnabled ) { return ; } /**
	 * We have made a conscious decision to ignore the 0 cost carts, such that these carts are not considered
	 * a conversion. We will analyze the results and make a final decision on this.
	 */ if ( cart . total_cost < 0.01 ) { debug ( 'recordOrderInFacebook: skipping due to a 0-value cart.' ) ; return ; } const currentUser = user . get ( ) ; const userId = currentUser ? hashPii ( currentUser . ID ) : 0 ; // WPCom if ( wpcomJetpackCartInfo . containsWpcomProducts ) { const params = [ 'trackSingle' , TRACKING_IDS . facebookInit , 'Purchase' , { product_slug : wpcomJetpackCartInfo . wpcomProducts . map ( product => product . product_slug ) . join ( ', ' ) , value : wpcomJetpackCartInfo . wpcomCost , currency : cart . currency , user_id : userId , order_id : orderId , } , ] ; debug ( 'recordOrderInFacebook: WPCom' , params ) ; window . fbq ( ... params ) ; } // Jetpack if ( wpcomJetpackCartInfo . containsJetpackProducts ) { const params = [ 'trackSingle' , TRACKING_IDS . facebookJetpackInit , 'Purchase' , { product_slug : wpcomJetpackCartInfo . jetpackProducts . map ( product => product . product_slug ) . join ( ', ' ) , value : wpcomJetpackCartInfo . jetpackCost , currency : cart . currency , user_id : userId , order_id : orderId , } , ] ; debug ( 'recordOrderInFacebook: Jetpack' , params ) ; window . fbq ( ... params ) ; } }
Records an order in Facebook (a single event for the entire order)

@param {Object} cart - cart as `CartValue` object
@param {Number} orderId - the order id
@param {Object} wpcomJetpackCartInfo - info about WPCOM and Jetpack in the cart
@returns {void}
Records an order in Facebook ( a single event for the entire order )