Automattic\WooCommerce\Admin\Notes

Notes::record_tracks_event_without_cookies()private staticWC 1.0

Record tracks event without using cookies.

Method of the class: Notes{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = Notes::record_tracks_event_without_cookies( $event_name, $params );
$event_name(string) (required)
Name of the event to record.
$params(array) (required)
The params to send to the event recording.

Notes::record_tracks_event_without_cookies() code WC 8.7.0

private static function record_tracks_event_without_cookies( $event_name, $params ) {
	// We save the cookie to set it back after the event recording.
	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
	$anon_id = isset( $_COOKIE['tk_ai'] ) ? $_COOKIE['tk_ai'] : null;

	unset( $_COOKIE['tk_ai'] );
	wc_admin_record_tracks_event( $event_name, $params );
	if ( isset( $anon_id ) ) {
		setcookie( 'tk_ai', $anon_id );
	}
}