WC_Settings_Tracking
in package
This class adds actions to track usage of WooCommerce Settings.
Table of Contents
- $added_options : array<string|int, mixed>
- List of options that have been added.
- $allowed_options : array<string|int, mixed>
- List of allowed WooCommerce settings to potentially track updates for.
- $deleted_options : array<string|int, mixed>
- List of options that have been deleted.
- $dropdown_menu_options : array<string|int, mixed>
- List of option names that are dropdown menus.
- $modified_options : array<string|int, mixed>
- List of options that have been modified.
- $toggled_options : array<string|int, mixed>
- Toggled options.
- $updated_options : array<string|int, mixed>
- WooCommerce settings that have been updated (and will be tracked).
- add_option_to_list() : mixed
- Add a WooCommerce option name to our allowed options list and attach the `update_option` hook. Rather than inspecting every updated option and pattern matching for "woocommerce", just build a dynamic list for WooCommerce options that might get updated.
- add_option_to_list_and_track_setting_change() : mixed
- Adds the option to the allowed and updated options directly.
- init() : mixed
- Init tracking.
- possibly_add_settings_tracking_scripts() : mixed
- Adds the tracking scripts for product setting pages.
- send_settings_change_event() : mixed
- Send a Tracks event for WooCommerce options that changed values.
- track_setting_change() : mixed
- Add WooCommerce option to a list of updated options.
- track_settings_page_view() : mixed
- Send a Tracks event for WooCommerce settings page views.
Properties
$added_options
List of options that have been added.
protected
array<string|int, mixed>
$added_options
= array()
$allowed_options
List of allowed WooCommerce settings to potentially track updates for.
protected
array<string|int, mixed>
$allowed_options
= array()
$deleted_options
List of options that have been deleted.
protected
array<string|int, mixed>
$deleted_options
= array()
$dropdown_menu_options
List of option names that are dropdown menus.
protected
array<string|int, mixed>
$dropdown_menu_options
= array()
$modified_options
List of options that have been modified.
protected
array<string|int, mixed>
$modified_options
= array()
$toggled_options
Toggled options.
protected
array<string|int, mixed>
$toggled_options
= array('enabled' => array(), 'disabled' => array())
$updated_options
WooCommerce settings that have been updated (and will be tracked).
protected
array<string|int, mixed>
$updated_options
= array()
Methods
add_option_to_list()
Add a WooCommerce option name to our allowed options list and attach the `update_option` hook. Rather than inspecting every updated option and pattern matching for "woocommerce", just build a dynamic list for WooCommerce options that might get updated.
public
add_option_to_list(array<string|int, mixed> $option) : mixed
See woocommerce_update_option
hook.
Parameters
- $option : array<string|int, mixed>
-
WooCommerce option (config) that might get updated.
Return values
mixed —add_option_to_list_and_track_setting_change()
Adds the option to the allowed and updated options directly.
public
add_option_to_list_and_track_setting_change(array<string|int, mixed> $option) : mixed
Currently used for settings that don't use update_option.
Parameters
- $option : array<string|int, mixed>
-
WooCommerce option that should be updated.
Return values
mixed —init()
Init tracking.
public
init() : mixed
Return values
mixed —possibly_add_settings_tracking_scripts()
Adds the tracking scripts for product setting pages.
public
possibly_add_settings_tracking_scripts(string $hook) : mixed
Parameters
- $hook : string
-
Page hook.
Return values
mixed —send_settings_change_event()
Send a Tracks event for WooCommerce options that changed values.
public
send_settings_change_event() : mixed
Return values
mixed —track_setting_change()
Add WooCommerce option to a list of updated options.
public
track_setting_change(string $option_name, mixed $old_value, mixed $new_value) : mixed
Parameters
- $option_name : string
-
Option being updated.
- $old_value : mixed
-
Old value of option.
- $new_value : mixed
-
New value of option.
Return values
mixed —track_settings_page_view()
Send a Tracks event for WooCommerce settings page views.
public
track_settings_page_view() : mixed