WC_Tracks_Event::build_pixel_url()
Build a pixel URL that will send a Tracks event when fired. On error, returns an empty string ('').
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();
WC_Tracks_Event::build_pixel_url() WC Tracks Event::build pixel url code WC 7.7.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 ) ); }