Event Collection API: Purchase Event

Prev Next

The purchase event should be fired when a visitor completes checkout on a product they previously viewed via search.

A purchase event should be sent in the following situations:

  • When a user completes checkout, and at least one product in the order received an impression from Eureka search or listing

  • Include all purchased product IDs in allPurchasedProducts (even non-Eureka products)

  • Only include Eureka-related products in the products array with their tracking data

Endpoint

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

Visit our Postman collection to test this request.

Payload Fields

The purchase event supports the following properties:

Attribute Name

Type

Validation

Default

Description

eventType

String

required, equals=purchase

-

Type of event

source

String

oneof: search-popup, search-listing, category-listing, brand-listing

-

Event-level source origin. Product-level source overrides this when provided.

userId

String

required

Default

Unique identifier of the user

platform

String

required, oneof: desktop-web, mobile-web, tablet-web, ios, android, other

-

Platform used by the user

integrationType

String

required, oneof: api, web, sdk, app

-

Type of integration

searchSessionId

String

Optional

-

Deprecated. Use products[].traceId instead. Falls back to product-level traceId. Kept for backward compatibility.

orderId

String

required

-

Unique ID of the order with at least one product that received impression from the search event.

allPurchasedProducts

List of string

required, min=1, each item excludes_space

-

List of all product IDs that were paid for (including those not related to Eureka). Must contain at least one item; items must not contain spaces

products

List of products

required

-

List of purchased products that received click from the search or listing event

referrer

String

required, url

-

Source URL of the referring page

createdAt

String

RFC 3339

If omitted or invalid, defaults to the current time

Time when the event is created

campId

Integer

-

999999

Campaign identifier

attributionWindow

List of string

required, min=1, each item excludes_space, oneof per item: predefined attribution windows

-

Event-level attribution time intervals. Product-level attributionWindow overrides this when provided.

variationId

Integer

-

999999

Variation identifier

Refer to Common Properties for further details.

Purchase Product Fields

Each product in the products array:

Parameter

Data Type

Validation

Default

Description

id

String

Required, excludes_space

-

Unique product identifier. Must not contain spaces

groupCode

String

-

-

Product group code. Without it, group-level analytics cannot be calculated.

price

Double

Required

Price of the product

convertedPrice

Double

-

If not provided, price is used

Converted price in preferred currency

currency

String

Required, excludes_space

-

Currency of the price (ISO 4217). Must not contain spaces

quantity

Integer

Required, min=1

1

Purchased quantity. Defaults to 1 if 0 or negative

source

String

Required, oneof: search-popup, search-listing, other, category-listing, brand-listing + source-dependent field validation

-

Source origin for this specific product. Each product can have a different source. Triggers source-dependent field validation (e.g., query required for search sources, listValue required for listing sources).

isMerchandisedItem

Boolean

Optional

false

Indicates whether the product is a merchandised (sponsored/promoted) item

traceId

String

Required

-

Trace identifier. Must match the traceId from the originating search or listing event

searchSessionId

String

-

-

Deprecated. Use traceId instead. Falls back bidirectionally with traceId. Kept for backward compatibility.

query

String

required if source is search-popup, search-listing

Default

The search query that produced the results

listValue

String

required if source is category-listing, brand-listing

-

Category/brand hierarchy (e.g. "electronics~laptops")

displayPosition

Integer

required, min=1

-

Position of the product when first displayed

clickPosition

Integer

required unless no result, min=1

-

Position of the product when clicked

attributionWindow

List of string

optional (overrides event-level value)

Falls back to event-level attributionWindow

Time intervals for attribution at the product level. When provided, overrides the event-level attributionWindow. If omitted, the event-level value is used.

preferredCurrency

String

-

If not specified, currency is used

The main currency of your site

sorting

String

Required

Relevancy

Sorting method

resultCount

Integer

Required unless no result, min=1

-

Number of results returned

itemsPerPage

Integer

Required unless no result, min=1

-

Number of items per page

totalPages

Integer

Required unless no result, min=1

-

Total number of pages

currentPage

Integer

Required unless no result, min=1

-

Current page number

facets

List of facets

-

-

Applied filters

sessionId

String

-

-

Browser/app session identifier

strategyId

String

-

-

Optional strategy identifier

Refer to Common Properties for further details.

Multiple Sources per Product:

Unlike other event types, each product in a purchase event can have its own source. This is because a single order may contain products that were found through different paths (e.g., one through search, another through a category listing).

allPurchasedProducts vs products:

The allPurchasedProducts field should contain the IDs of all products in the order, including those that are not related to Eureka. The products array should only contain the detailed information for products that were accessed through Eureka search or listing pages.

Attribution Window:

When sending data for purchase events, consider the time window your event falls within. Only include values from the predefined windows that encompass the event timeframe. For instance, if an item was added to the cart on the eighth day, you would only send the values for "14", "30", and "90" because those windows include the eighth day.

Source Sanitization:

At the product level, the following legacy source values are automatically converted:

  • collection-listingcategory-listing

  • othersearch-listing

  • product-detailsearch-listing

Advanced Analytics (September, 01 2025 release):

The event now retrieves currentPage and source from the product-level fields instead of the top-level fields. You may continue sending values at the event level for backward compatibility, but it is recommended to update your implementation to the new product-level structure.

Default Values & Fallback Behavior

  • product.quantity: Defaults to 1 if 0 or negative

  • product.sorting: Defaults to "Relevancy" if empty

  • product.source: Sanitized -- collection-listing -> category-listing, other/product-detail -> search-listing

  • product.traceId <-> searchSessionId: 3-layer bidirectional fallback: product.traceId -> product.searchSessionId -> event.searchSessionId

Sample Request (Multiple Sources per Product)

In the example below, you see a sample request along with guidance on how to modify 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/cart",
  "userId": "user-12345",
  "platform": "android",
  "campId": 100,
  "variationId": 200,
  "source": "search-listing",
  "attributionWindow": ["session", "1", "7", "30", "90"],
  "searchSessionId": "search-session-abc123",
  "orderId": "order-xyz789",
  "allPurchasedProducts": [
    "product-001",
    "product-002",
    "product-003"
  ],
  "products": [
    {
      "traceId": "search-session-abc123",
      "strategyId": "strategy-id-123",
      "sessionId": "session-id-123",
      "source": "category-listing",
      "id": "product-001",
      "groupCode": "group-1",
      "listValue": "categoryA~categoryB",
      "resultCount": 25,
      "itemsPerPage": 10,
      "totalPages": 3,
      "currentPage": 1,
      "sorting": "PriceDesc",
      "facets": [
        {
          "label": "Fiyat",
          "field": "price",
          "values": ["500", "2000"]
        }
      ],
      "price": 1299.99,
      "convertedPrice": 1199.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "clickPosition": 1,
      "displayPosition": 1,
      "quantity": 2,
      "attributionWindow": ["session", "1", "7", "30", "90"]
    },
    {
      "traceId": "search-session-def456",
      "strategyId": "strategy-id-123",
      "sessionId": "session-id-123",
      "source": "search-listing",
      "id": "product-002",
      "groupCode": "group-2",
      "query": "queryA",
      "resultCount": 15,
      "itemsPerPage": 10,
      "totalPages": 2,
      "currentPage": 1,
      "sorting": "MostPopularFirst",
      "facets": [
        {
          "label": "Brand",
          "field": "brand_en",
          "values": ["brandA"]
        }
      ],
      "price": 49.99,
      "convertedPrice": 45.99,
      "currency": "USD",
      "preferredCurrency": "EUR",
      "clickPosition": 2,
      "displayPosition": 2,
      "quantity": 1,
      "attributionWindow": ["session", "1", "7", "30", "90"]
    }
  ],
  "eventType": "purchase",
  "integrationType": "api",
  "createdAt": "2025-11-25T10:50:00Z"
}'