WordPress at Your Fingertips
function is not described

WC_Tracks_Event::build_pixel_url() public WC 1.0

Build a pixel URL that will send a Tracks event when fired. On error, returns an empty string ('').

{} It's a method of the class: WC_Tracks_Event{}

No Hooks.

Return

String. A pixel URL or empty string ('') if there were invalid args.

Usage

$WC_Tracks_Event = new WC_Tracks_Event();
$WC_Tracks_Event->build_pixel_url();

Code of WC_Tracks_Event::build_pixel_url() WC 5.8.0

public function build_pixel_url() {
	if ( $this->error ) {
		return '';
	}

	$args = get_object_vars( $this );

	// Request Timestamp and URL Terminator must be added just before the HTTP request or not at all.
	unset( $args['_rt'], $args['_'] );

	$validated = self::validate_and_sanitize( $args );

	if ( is_wp_error( $validated ) ) {
		return '';
	}

	return esc_url_raw( WC_Tracks_Client::PIXEL . '?' . http_build_query( $validated ) );
}