Records an order in Google Analytics

@see https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

@param {Object} cart - cart as `CartValue` object
@param {Number} orderId - the order id
@returns {void}
function recordOrderInGoogleAnalytics( cart, orderId ) {
	if ( ! isAdTrackingAllowed() ) {
		debug( 'recordOrderInGoogleAnalytics: skipping as ad tracking is disallowed' );
		return;
	}

	const transaction = {
		id: orderId,
		affiliation: 'WordPress.com',
		revenue: cart.total_cost,
		currency: cart.currency,
	};
	debug( 'recordOrderInGoogleAnalytics: ga ecommerce add transaction', transaction );
	window.ga( 'ecommerce:addTransaction', transaction );
}