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 Name

Type

Validation

Default

Description

referrer

String

Required, url

-

Source URL of the referring page

campId

Integer

-

999999

A unique identifier assigned to a campaign. Refer to common fields for more details.

variationId

Integer

-

999999

A unique identifier assigned to a specific variation within a campaign. Refer to common fields for more details.

source

String

oneof=
- search-popup
- search-listing


Component where the search engine is used

platform

String

Required,
oneof=
- desktop-web
- mobile-web

- tablet-web
- ios
- android
- other

-

Platform used by the user

integrationType

String

Required,
oneof=
- api
- web

-

Type of integration

traceId

String

Required

-

Unique trace identifier created for the current query. Refer to common fields for more details.

sessionId

String

-

-

Browser/app session identifier

strategyId

String

-

-

Optional strategy identifier

userId

String

Required

Default

Unique identifier of the user. It is expected to provide for user-based calculations.

query

String

Required

-

Query the user searched with

resultCount

Integer

Required, unless no result, min=1

-

Number of search results returned

itemsPerPage

Integer

Required, unless no result, min=1

-

Number of items per page used in the search request

totalPages

Integer

Required, unless no result, min=1

-

Total number of pages returned by the search

currentPage

Integer

Required, unless no result, min=1

-

Page number where the search results are displayed

sorting

String

Required

Relevancy

The 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.

facets

List of facets

-

-

List of facets of the search. Required if any facet selected. Refer to common fields for more details.

products

List of products

Required, unless no result

-

List of products returned by the search Refer to common fields for more details.

eventType

String

Required, equals=search

-

Type of event

createdAt

String

Required, formatted in RFC3339

If omitted or invalid, it defaults to the current time

Time 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 traceId, a 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 the same session. Sending the product once under the same traceId is sufficient.

Example Conceptual flow

  • User submits a search query

    • Example: query = "myphone"

    • Generated traceId = "x123" for this search session.

  • First response is returned

    • Products:myiphone 11, myphone 12, myphone 13

    • Tracking layer checks: “Have I already sent  myphone 11, myphone 12, or myphone 13 for traceId = x123?”

  • Send only new products to tracking

    • Initially, nothing has been sent yet, so:

      • Send myphone 11, myphone 12, myphone 13

      • Mark them as seen for x123.

  • User changes sorting / goes to next page / applies a filter

    • Under the same traceId = x123.

    • Some products may repeat and some may be new (e.g. myphone X, myphone 17).

  • Before sending events, filter out already-seen products

    • Compare the new product list with the set {myphone 11, myphone 12, myphone 13} already sent for x123.

    • Only send tracking events for products not in that 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",
  "traceId": "search-traceId-abc123",
  "strategyId":"strategy-id-123",
  "sessionId":"session-id-123",
  "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": ["Pear", "Deli", "SP"]
    }
  ],
  "products": [
    {
      "id": "product-001",
      "groupCode": "laptop-group-1",
      "price": 1299.99,
      "convertedPrice": 1199.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "displayPosition": 1
    },
    {
      "id": "product-002",
      "groupCode": "laptop-group-2",
      "price": 899.99,
      "convertedPrice": 829.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "displayPosition": 2
     }
  ],
  "eventType": "search",
  "integrationType": "web",
  "createdAt": "2025-11-25T10:30:00Z"
}'