Skip to main content

search_submitted
interface

The search_submitted event logs an instance where a customer performed a search on the storefront. The products returned from the search query are in this event object (the first product variant for each product is listed in the array). This event is available on the online store page.

string

The client-side ID of the customer, provided by Shopify

string

The ID of the customer event

string

The name of the customer event

number

The sequence index number of the event.

string

The timestamp of when the customer event occurred, in ISO 8601 format

.Standard
Was this section helpful?

Accessing Standard Events

import {register} from '@shopify/web-pixels-extension';

register(({analytics}) => {
analytics.subscribe('search_submitted', (event) => {
// Example for accessing event data
const searchResult = event.data.searchResult;

const searchQuery = searchResult.query;

const firstProductReturnedFromSearch =
searchResult.productVariants[0]?.product.title;

const payload = {
event_name: event.name,
event_data: {
searchQuery: searchQuery,
firstProductTitle: firstProductReturnedFromSearch,
},
};

// Example for sending event to third party servers
fetch('https://example.com/pixel', {
method: 'POST',
body: JSON.stringify(payload),
keepalive: true,
});
});
});