Event Collection API: Search Event

Prev Next

The search event should be fired when a visitor makes a search for a product or content.

It is recommended to send the search event with each request unless you are using Eureka in a search-as-you-type experience.

If you are using search-as-you-type, the search event should be sent after the user completes their discovery, such as when they click on a product or navigate to another page.

If the user stops typing and does not interact with facets, sorting, or pagination, you may assume the query is complete and trigger the search event. A 10-second waiting time is recommended to determine when the user has paused long enough to consider the search finalized.

Endpoint

POST https://eurekaevent.api.useinsider.com/api/v1/events

Visit our Postman collection to test this request.

Request Parameters

The search event supports the following properties:

Attribute NameTypeValidationDefaultDescription
referrerStringRequired, url-Source URL of the referring page
campIdInteger-999999A unique identifier assigned to a campaign. Refer to common fields for more details.
variationIdInteger-999999A unique identifier assigned to a specific variation within a campaign. Refer to common fields for more details.
sourceStringoneof=
- search-popup
- search-listing
- collection-listing
- product-detail
- other

Component where the search engine is used
platformStringRequired,
oneof=
- desktop-web
- mobile-web
- ios
- android
- other
-Platform used by the user
integrationTypeStringRequired,
oneof=
- api
- web
-Type of integration
searchSessionIdStringRequired-Unique session ID created for the current query. Refer to common fields for more details.
userIdStringRequiredDefaultUnique identifier of the user. It is expected to provide for user-based calculations.
queryStringRequired-Query the user searched with
resultCountIntegerRequired, unless no result, min=1-Number of search results returned
itemsPerPageIntegerRequired, unless no result, min=1-Number of items per page used in the search request
totalPagesIntegerRequired, unless no result, min=1-Total number of pages returned by the search
currentPageIntegerRequired, unless no result, min=1-Page number where the search results are displayed
sortingStringRequiredRelevancyThe sorting method used in the search request. It is the type of sorting object of the search response. Refer to common fields for more details.
facetsList of facets--List of facets of the search. Required if any facet selected. Refer to common fields for more details.
productsList of productsRequired, unless no result-List of products returned by the search Refer to common fields for more details.
eventTypeStringRequired, equals=search-Type of event
createdAtStringRequired, formatted in RFC3339If omitted or invalid, it defaults to the current timeTime when the event is created. Refer to common fields for more details.
If your integration was implemented before the Advanced Analytics September 01, 2025, release, please be aware that new fields have been added to the expected product payload structure. You are required to review and implement these additions to ensure more comprehensive and accurate analytics.
You can view the differences in the updated payload structure in the Common Properties.

For the same searchSessionId, each product must be sent only once. Even if the user interacts with sorting, pagination, or facet filters, the same product should not be sent again within that session. Sending a product a single time per searchSessionId is sufficient.

Example Conceptual Flow

1. User submits a search query

Example: query = "myphone"

A new searchSessionId = "x123" is generated for this search session.

2. First response is returned

Products: myphone 11, myphone 12, myphone 13

The tracking layer should check:

“Have I already sent myphone 11, iphone 12, or iphone 13 for searchSessionId = x123?”

Since nothing has been sent yet:

Send myphone 11, myphone 12, myphone 13

Mark these products as seen for session x123

3. User interacts with the search results

(e.g., changes sorting, navigates to the next page, or applies filters)

This occurs under the same searchSessionId = x123.

The new product list may include previously seen items and new items (e.g., myphone X, myphone 17).

4. Before sending events, filter out previously seen products

Compare the new results with the already-seen set:

{myphone 11, myphone 12, myphone 13}

Only send tracking events for new products that are not in the previously seen set.

Suggested Tips for Search Event Collection

To ensure accurate and efficient search event tracking, the following recommendations should be applied:

Timer-Based Event Triggering

  • Each time the user types in the search input or interacts with filters (such as sorting, pagination, or facets) within the search popup, a 10-second timer is triggered.
  • If the user performs another action before the 10 seconds elapse, the timer is reset.
  • If no interactions occur within 10 seconds, the search event log is sent.

Additional Scenarios Requiring Search Event Logging

A search event should also be sent in the following situations if it has not already been logged:

  • When the user clicks a product and navigates to the product page
  • On exit intent, if the log has not yet been sent
  • When a product is added to the cart
  • When the user deletes the entire query (send for the previous query if not yet logged)
  • When the user copies and pastes a new query (send for the previous query if not yet logged)
  • When the user modifies the query after applying a facet (send for the previous query if not yet logged)

These recommendations ensure that search events are captured reliably without duplication, providing more accurate insights into user behavior.

To gain a deeper understanding, check out the details on facet and product fields on the Common Properties page.
Please note that the following user actions are also considered search requests:
- Changing the sorting option
- Applying a facet filter
- Pagination

Sample Request

In the example below, you see a sample request along with guidance on modifying the necessary fields. This will help you seamlessly integrate and make the most of the provided configuration.

Before usage, modifying the values such as x-auth-token and x-partner-config-key is essential.
curl --location --request POST 'https://eurekaevent.api.useinsider.com/api/v1/events' \
--header 'x-auth-token: YOUR_AUTH_TOKEN' \
--header 'x-partner-config-key: YOUR_PARTNERID-YOUR_LOCALE' \
--header 'Content-Type: application/json' \
--data-raw '{
  "referrer": "https://example.com/homepage",
  "source": "search-listing",
  "userId": "user-12345",
  "platform": "desktop-web",
  "campId": 999999,
  "variationId": 999999,
  "query": "laptop",
  "searchSessionId": "search-session-abc123",
  "resultCount": 25,
  "itemsPerPage": 10,
  "totalPages": 3,
  "currentPage": 1,
  "sorting": "Relevancy",
  "facets": [
    {
      "label": "Price",
      "field": "price_en",
      "values": ["500", "2000"]
    },
    {
      "label": "Brand",
      "field": "brand_en",
      "values": ["Apple", "Dell", "HP"]
    }
  ],
  "products": [
    {
      "id": "product-001",
      "groupCode": "laptop-group-1",
      "price": 1299.99,
      "convertedPrice": 1199.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "searchPosition": 1
    },
    {
      "id": "product-002",
      "groupCode": "laptop-group-2",
      "price": 899.99,
      "convertedPrice": 829.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "searchPosition": 2
     }
  ],
  "eventType": "search",
  "integrationType": "web",
  "createdAt": "2025-11-25T10:30:00Z"
}'