Commit ef02a488bb1 for woocommerce
commit ef02a488bb172898edc942ae6a110f9d857a2bdb
Author: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Date: Wed Sep 2 12:19:17 2026 +0800
Fix store search event being rejected by Tracks ingest (#68246)
* fix: rename store search event to satisfy Tracks name format
Tracks ingest requires event names of the form <source>_<context>_<action>.
"woocommerceanalytics_search" has only two segments, so every one of these
events has been rejected since the event was introduced in 0.4.0 (Jan 2025),
around 8.7M per week with zero accepted.
Renaming to "search_performed" gives the prefixed name three segments and
matches the sibling events in the family (product_view, cart_view,
add_to_cart), which all ingest fine.
There is no backfill: the data was never stored, so the event's history
starts on the day this ships.
DOTCOM-18362
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
diff --git a/packages/php/woocommerce-analytics/changelog/fix-dotcom-18362-search-event-name b/packages/php/woocommerce-analytics/changelog/fix-dotcom-18362-search-event-name
new file mode 100644
index 00000000000..7eda0faae86
--- /dev/null
+++ b/packages/php/woocommerce-analytics/changelog/fix-dotcom-18362-search-event-name
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Rename the store search event so Tracks ingest stops rejecting it.
diff --git a/packages/php/woocommerce-analytics/src/class-universal.php b/packages/php/woocommerce-analytics/src/class-universal.php
index 8c13712170c..bed286783c6 100644
--- a/packages/php/woocommerce-analytics/src/class-universal.php
+++ b/packages/php/woocommerce-analytics/src/class-universal.php
@@ -547,7 +547,7 @@ class Universal {
if ( is_search() ) {
global $wp_query;
$this->enqueue_event(
- 'search',
+ 'search_performed',
array(
'search_query' => $this->cap_page_string( $wp_query->get( 's' ) ),
'qty' => $wp_query->found_posts,
diff --git a/packages/php/woocommerce-analytics/tests/php/Universal_Page_Output_Test.php b/packages/php/woocommerce-analytics/tests/php/Universal_Page_Output_Test.php
index c3ddb34f210..5229e5c7d9a 100644
--- a/packages/php/woocommerce-analytics/tests/php/Universal_Page_Output_Test.php
+++ b/packages/php/woocommerce-analytics/tests/php/Universal_Page_Output_Test.php
@@ -384,7 +384,7 @@ class Universal_Page_Output_Test extends BaseTestCase {
$this->assertNotEmpty( $queue, 'A search event should have been queued.' );
$event = end( $queue );
- $this->assertSame( 'search', $event['eventName'], 'The queued event should be the search event.' );
+ $this->assertSame( 'search_performed', $event['eventName'], 'The queued event should be the search event.' );
return (string) ( $event['props']['search_query'] ?? '' );
}