Automattic\WooCommerce\Admin\Notes
Notes::record_tracks_event_without_cookies
Record tracks event without using cookies.
Method of the class: Notes{}
No Hooks.
Returns
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() Notes::record tracks event without cookies code WC 10.4.3
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 ) ) {
WC_Site_Tracking::set_tracking_cookie( 'tk_ai', $anon_id );
}
}