WooCommerce Code Reference

Search results

WC_Tracks_Client

WC_Tracks_Client class.

Table of Contents

PIXEL Pixel URL. 'https://pixel.wp.com/t.gif'
BROWSER_TYPE Browser type. 'php-agent'
USER_AGENT_SLUG User agent. 'tracks-client'
init() Initialize tracks client class void
maybe_set_identity_cookie() Check if identiy cookie is set, if not set it. void
record_event() Record a Tracks event bool|WP_Error
record_pixel() Synchronously request the pixel. bool
build_timestamp() Create a timestap representing milliseconds since 1970-01-01 string
get_identity() Get a user's identity to send to Tracks. If Jetpack exists, default to its implementation. array
get_anon_id() Grabs the user's anon id from cookies, or generates and sets a new one string

Constants

Methods

maybe_set_identity_cookie()

Check if identiy cookie is set, if not set it.

public static maybe_set_identity_cookie( ) : void

record_event()

Record a Tracks event

public static record_event( $event : array ) : bool|WP_Error
Parameters
$event : array

Array of event properties.

Return values
bool|WP_Error

True on success, WP_Error on failure.

record_pixel()

Synchronously request the pixel.

public static record_pixel( $pixel : string ) : bool
Parameters
$pixel : string

pixel url and query string.

Return values
bool

Always returns true.

build_timestamp()

Create a timestap representing milliseconds since 1970-01-01

public static build_timestamp( ) : string
Return values
string

A string representing a timestamp.

get_identity()

Get a user's identity to send to Tracks. If Jetpack exists, default to its implementation.

public static get_identity( $user_id : int ) : array
Parameters
$user_id : int

User id.

Return values
array

Identity properties.

get_anon_id()

Grabs the user's anon id from cookies, or generates and sets a new one

public static get_anon_id( ) : string
Return values
string

An anon id for the user

Back to the top