Automattic\WooCommerce\Internal\Admin\Settings
Payments::record_event
Send a Tracks event.
By default, Woo adds url, blog_lang, blog_id, store_id, products_count, and wc_version properties to every event.
Метод класса: Payments{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->record_event( $name, $properties );
- $name(строка) (обязательный)
- The event name. If it is not prefixed with self::EVENT_PREFIX, it will be prefixed with it.
- $properties(массив)
- The event custom properties. These properties will be merged with the default properties.
По умолчанию:properties values take precedence over the provided ones
Код Payments::record_event() Payments::record event WC 10.8.1
private function record_event( string $name, array $properties = array() ) {
if ( ! function_exists( 'wc_admin_record_tracks_event' ) ) {
return;
}
// If the event name is empty, we don't record it.
if ( empty( $name ) ) {
return;
}
// If the event name is not prefixed with `settings_payments_`, we prefix it.
if ( ! str_starts_with( $name, self::EVENT_PREFIX ) ) {
$name = self::EVENT_PREFIX . $name;
}
// Add default properties to every event and overwrite custom properties with the same keys.
$properties = array_merge(
$properties,
array(
'business_country' => $this->get_country(),
),
);
wc_admin_record_tracks_event( $name, $properties );
}