WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Tracks::record_event() public WC 1.0

Record an event in Tracks - this is the preferred way to record events from PHP.

Это метод класса: WC_Tracks{}

Хуки из метода
Возвращает

true/false/WP_Error. True for success or WP_Error if the event pixel could not be fired.

Использование

$result = WC_Tracks::record_event( $event_name, $properties );
$event_name(строка) (обязательный)
The name of the event.
$properties(массив)
Custom properties to send with the event.
По умолчанию: array()

Код WC_Tracks::record_event() WC 4.5.2

woocommerce/includes/tracks/class-wc-tracks.php
<?php
public static function record_event( $event_name, $properties = array() ) {
	/**
	 * Don't track users who don't have tracking enabled.
	 */
	if ( ! WC_Site_Tracking::is_tracking_enabled() ) {
		return false;
	}

	$user = wp_get_current_user();

	// We don't want to track user events during unit tests/CI runs.
	if ( $user instanceof WP_User && 'wptests_capabilities' === $user->cap_key ) {
		return false;
	}
	$prefixed_event_name = self::PREFIX . $event_name;

	$data = array(
		'_en' => $prefixed_event_name,
		'_ts' => WC_Tracks_Client::build_timestamp(),
	);

	$server_details = self::get_server_details();
	$identity       = WC_Tracks_Client::get_identity( $user->ID );
	$blog_details   = self::get_blog_details( $user->ID );

	// Allow event props to be filtered to enable adding site-wide props.
	$filtered_properties = apply_filters( 'woocommerce_tracks_event_properties', $properties, $prefixed_event_name );

	// Delete _ui and _ut protected properties.
	unset( $filtered_properties['_ui'] );
	unset( $filtered_properties['_ut'] );

	$event_obj = new WC_Tracks_Event( array_merge( $data, $server_details, $identity, $blog_details, $filtered_properties ) );

	if ( is_wp_error( $event_obj->error ) ) {
		return $event_obj->error;
	}

	return $event_obj->record();
}