diff --git a/plugins/woocommerce-admin/client/launch-your-store/settings/slotfill.js b/plugins/woocommerce-admin/client/launch-your-store/settings/slotfill.js index 7cea29f7ec5..d0eb2cc567f 100644 --- a/plugins/woocommerce-admin/client/launch-your-store/settings/slotfill.js +++ b/plugins/woocommerce-admin/client/launch-your-store/settings/slotfill.js @@ -12,6 +12,7 @@ import { registerPlugin } from '@wordpress/plugins'; import { __ } from '@wordpress/i18n'; import classNames from 'classnames'; import { useCopyToClipboard } from '@wordpress/compose'; +import { recordEvent } from '@woocommerce/tracks'; /** * Internal dependencies @@ -91,6 +92,9 @@ const SiteVisibility = () => { { setComingSoon( 'yes' ); + recordEvent( 'site_visibility_toggle', { + status: 'coming_soon', + } ); } } options={ [ { @@ -130,10 +134,16 @@ const SiteVisibility = () => { } checked={ storePagesOnly === 'yes' } - onChange={ () => { + onChange={ ( enabled ) => { setStorePagesOnly( storePagesOnly === 'yes' ? 'no' : 'yes' ); + recordEvent( + 'site_visibility_restrict_store_pages_only_toggle', + { + enabled, + } + ); } } /> { 'woocommerce' ) }

- { privateLink === 'yes' && ( -
- { getPrivateLink() } - -
- ) } } checked={ privateLink === 'yes' } - onChange={ () => { + onChange={ ( enabled ) => { setPrivateLink( privateLink === 'yes' ? 'no' : 'yes' ); + recordEvent( + 'site_visibility_share_private_link_toggle', + { + enabled, + } + ); } } /> + { privateLink === 'yes' && ( +
+ { getPrivateLink() } + +
+ ) }
{ setComingSoon( 'no' ); + recordEvent( 'site_visibility_toggle', { + status: 'live', + } ); } } options={ [ { diff --git a/plugins/woocommerce-admin/client/launch-your-store/settings/style.scss b/plugins/woocommerce-admin/client/launch-your-store/settings/style.scss index 404db0206dc..c787d7f6516 100644 --- a/plugins/woocommerce-admin/client/launch-your-store/settings/style.scss +++ b/plugins/woocommerce-admin/client/launch-your-store/settings/style.scss @@ -9,6 +9,7 @@ } .site-visibility-settings-slotfill-private-link { + margin-left: 73px; padding: 8px 16px; border-radius: 4px; border: 1px solid #dcdcde; diff --git a/plugins/woocommerce/changelog/46078-add-45873-track-site-visibility-action b/plugins/woocommerce/changelog/46078-add-45873-track-site-visibility-action new file mode 100644 index 00000000000..39cfaf93b92 --- /dev/null +++ b/plugins/woocommerce/changelog/46078-add-45873-track-site-visibility-action @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Add tracks for site visibility settings \ No newline at end of file diff --git a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php index 862a6d4a19b..2d10ec2faaa 100644 --- a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php +++ b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php @@ -37,13 +37,20 @@ class LaunchYourStore { 'woocommerce_private_link' => array( 'yes', 'no' ), ); + $at_least_one_saved = false; + foreach ( $options as $name => $option ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized if ( isset( $_POST[ $name ] ) && in_array( $_POST[ $name ], $option, true ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized update_option( $name, wp_unslash( $_POST[ $name ] ) ); + $at_least_one_saved = true; } } + + if ( $at_least_one_saved ) { + wc_admin_record_tracks_event( 'site_visibility_saved' ); + } } /**