WooCommerce Code Reference

WC_Tracks_Event
in package

WC_Tracks_Event class.

Table of Contents

EVENT_NAME_REGEX  = '/^(([a-z0-9]+)_){1}([a-z0-9_]+)$/'
Event name regex.
PROP_NAME_REGEX  = '/^[a-z_][a-z0-9_]*$/'
Property name regex.
$error  : WP_Error
Error message as WP_Error.
__construct()  : mixed
WC_Tracks_Event constructor.
build_pixel_url()  : string
Build a pixel URL that will send a Tracks event when fired.
event_name_is_valid()  : false|int
Check if event name is valid.
prop_name_is_valid()  : false|int
Check if a property name is valid.
record()  : bool
Record Tracks event
scrutinize_event_names()  : mixed
Check event names
validate_and_sanitize()  : bool|WP_Error
Annotate the event with all relevant info.

Constants

Properties

Methods

__construct()

WC_Tracks_Event constructor.

public __construct(array<string|int, mixed> $event) : mixed
Parameters
$event : array<string|int, mixed>

Event properties.

Return values
mixed

build_pixel_url()

Build a pixel URL that will send a Tracks event when fired.

public build_pixel_url() : string

On error, returns an empty string ('').

Return values
stringA pixel URL or empty string ('') if there were invalid args.

event_name_is_valid()

Check if event name is valid.

public static event_name_is_valid(string $name) : false|int
Parameters
$name : string

Event name.

Return values
false|int

prop_name_is_valid()

Check if a property name is valid.

public static prop_name_is_valid(string $name) : false|int
Parameters
$name : string

Event property.

Return values
false|int

scrutinize_event_names()

Check event names

public static scrutinize_event_names(object $event) : mixed
Parameters
$event : object

An event object.

Return values
mixed

validate_and_sanitize()

Annotate the event with all relevant info.

public static validate_and_sanitize(array<string|int, mixed> $event) : bool|WP_Error
Parameters
$event : array<string|int, mixed>

Event arguments.

Return values
bool|WP_ErrorTrue on success, WP_Error on failure.