WooCommerce Code Reference

WC_Tracks
in package

WC_Tracks class.

Table of Contents

PREFIX  = 'wcadmin_'
Tracks event name prefix.
get_blog_details()  : array<string|int, mixed>
Gather blog related properties.
get_products_count()  : int
Get total product counts.
get_properties()  : array<string|int, mixed>
Get all properties for the event including filtered and identity properties.
get_server_details()  : array<string|int, mixed>
Gather details from the request to the server.
record_event()  : bool|WP_Error
Record an event in Tracks - this is the preferred way to record events from PHP.

Constants

Methods

get_blog_details()

Gather blog related properties.

public static get_blog_details(int $user_id) : array<string|int, mixed>
Parameters
$user_id : int

User id.

Return values
array<string|int, mixed>Blog details.

get_properties()

Get all properties for the event including filtered and identity properties.

public static get_properties(string $event_name, array<string|int, mixed> $event_properties) : array<string|int, mixed>
Parameters
$event_name : string

Event name.

$event_properties : array<string|int, mixed>

Event specific properties.

Return values
array<string|int, mixed>

get_server_details()

Gather details from the request to the server.

public static get_server_details() : array<string|int, mixed>
Return values
array<string|int, mixed>Server details.

record_event()

Record an event in Tracks - this is the preferred way to record events from PHP.

public static record_event(string $event_name[, array<string|int, mixed> $event_properties = array() ]) : bool|WP_Error

Note: the event request won't be made if $properties has a member called error.

Parameters
$event_name : string

The name of the event.

$event_properties : array<string|int, mixed> = array()

Custom properties to send with the event.

Return values
bool|WP_ErrorTrue for success or WP_Error if the event pixel could not be fired.