Eureka SDK Log Collection Methods

Prev Next

All Eureka SDK log collection methods are accessible under the Insider.eureka.track namespace:

Two types of logs are available:

  • Manually Collected Logs: You must call Insider.eureka.track.* methods for these events (page view, search, click, add-to-cart on listing pages).

  • Automatically Collected Logs: Add-to-cart on the Product Details Page (PDP) and purchase events are collected automatically. You do not need to call any track method for these.

Manually Collected Logs

For Category and Brand Listing Pages

Event

Track Method

Description

Page view (listing)

productListingView

When a user views a category or brand listing page

Product click (listing)

productClickAfterListing

When a user clicks on a product from a listing page

Add to cart (listing)

productAddToCartAfterListing

When a user adds a product to the cart directly from a listing page

For Search Popup and Search Listing Pages

Event

Track Method

Description

Search (search)

search

When a user performs a search

Product click (search)

productClickAfterSearch

When a user clicks on a product from the search results

Add to cart (search)

productAddToCartAfterSearch

When a user adds a product to the cart directly from search results

Every time a user interacts with filters (facets), pagination, or sorting, the corresponding track method must be called again with the updated data. For example, if a user changes sorting on a category listing page, call productListingView again with the new results.

productListingView

Call this when a user views a category or brand listing page. Also call it again when the user changes sorting, applies filters, or navigates to a different page.

  • Method: Insider.eureka.track.productListingView(campId, listingPageName, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID received from the eureka:sdk:campaign:ready event

listingPageName

String

Listing page name. Use ~ as a hierarchy separator (e.g., 'categoryA~categoryB')

payload

Object

Event data (see below)

  • Payload fields

Field

Type

Required

Description

products

Array

Yes

Products displayed on the page

products[].id

String

Yes

Product identifier

products[].price

Number

Yes

Product price

products[].groupCode

String

No

Product variant group code

products[].displayPosition

Number

No

Position of the product on the page (1-indexed)

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total number of results

pagination.itemsPerPage

Number

No

Items per page

pagination.totalPages

Number

No

Total pages

pagination.currentPage

Number

No

Current page number

sorting

String

No

Current sorting method. Default: 'Relevancy'

facets

Array

No

Active filters

facets[].label

String

No

Filter label (e.g. 'Price')

facets[].field

String

No

Filter field name (e.g. 'price_en')

facets[].values

Array

No

Selected filter values (e.g. ['500', '2000'])

source

String

No

Default: 'category-listing'. Set to 'brand-listing' for brand pages

Example:

Insider.eureka.track.productListingView(470, 'categoryA~categoryB', {
    pagination: {
        resultCount: 84,
        itemsPerPage: 24,
        totalPages: 4,
        currentPage: 1,
    },
    sorting: 'Relevancy',
    facets: [
        { label: 'Price', field: 'price_en', values: ['500', '2000'] },
    ],
    products: [
        { id: 'product-001', groupCode: 'group-1', price: 1299.99, displayPosition: 1 },
        { id: 'product-002', groupCode: 'group-2', price: 899.99, displayPosition: 2 },
    ],
});

Example - Brand listing (set source):

Insider.eureka.track.productListingView(470, 'BrandName', {
    source: 'brand-listing',
    pagination: { resultCount: 50 },
    products: [
        { id: 'product-001', price: 999.99, displayPosition: 1 },
    ],
});

search

Call this when a user performs a search. Also, call it again when the user changes sorting, applies filters, or navigates to the next page within the search results.

  • Method: Insider.eureka.track.search(campId, query, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID

query

String

The search query entered by the user

payload

Object

Event data (see below)

  • Payload Fields

Field

Type

Required

Description

products

Array

Yes

Products returned in the search results

products[].id

String

Yes

Product identifier

products[].price

Number

Yes

Product price

products[].groupCode

String

No

Product variant group code

products[].displayPosition

Number

No

Position in the search results (1-indexed)

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total number of search results

pagination.itemsPerPage

Number

No

Items per page

pagination.totalPages

Number

No

Total pages

pagination.currentPage

Number

No

Current page number

sorting

String

No

Current sorting method. Default: 'Relevancy'

facets

Array

No

Active filters

source

String

No

Default: 'search-listing'. Set to 'search-popup' for search popup.

Example:

Insider.eureka.track.search(999999, 'queryA', {
    pagination: {
        resultCount: 25,
        itemsPerPage: 24,
        totalPages: 2,
        currentPage: 1,
    },
    sorting: 'Relevancy',
    products: [
        { id: 'product-001', price: 999.99, displayPosition: 1 },
        { id: 'product-002', price: 1099.99, displayPosition: 2 },
    ],
});

productClickAfterListing

Call this when a user clicks on a product from a category or brand listing page.

  • Method: Insider.eureka.track.productClickAfterListing(campId, listingPageName, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID

listingPageName

String

Same page name used in the preceding productListingView call

payload

Object

Event data (see below)

  • Payload Fields

Field

Type

Required

Description

product

Object

Yes

The clicked product

product.id

String

Yes

Product identifier

product.price

Number

Yes

Product price

product.groupCode

String

No

Product variant group code

product.displayPosition

Number

No

Position where the product was displayed

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total result count

sorting

String

No

Current sorting method

facets

Array

No

Active filters

source

String

No

Default: 'category-listing'. Set to 'brand-listing' for brand pages.

traceId

String

No

On the listing page, this is handled automatically.

SDK add-to-cart methods do not trigger a click event automatically. When a user clicks the "Add to Cart" button directly on a product card in the listing page, you must call productClickAfterListing first, then productAddToCartAfterListing.

displayPosition refers to the position where the user first saw the product for a given listing. After facet or sorting changes, the same product may appear in a different position. In this case, displayPosition (original position) and clickPosition (position at the time of click) may differ.

Example:

Insider.eureka.track.productClickAfterListing(470, 'categoryA~categoryB', {
    pagination: { resultCount: 84 },
    product: {
        id: 'product-001',
        groupCode: 'group-1',
        price: 1299.99,
        displayPosition: 3,
    },
});

productClickAfterSearch

Call this when a user clicks on a product from the search results page.

  • Method: Insider.eureka.track.productClickAfterSearch(campId, query, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID

query

String

The search query that led to this click

payload

Object

Event data (see below)

  • Payload Fields:

Field

Type

Required

Description

product

Object

Yes

The clicked product

product.id

String

Yes

Product identifier

product.price

Number

Yes

Product price

product.groupCode

String

No

Product variant group code

product.displayPosition

Number

No

Position where the product was displayed

product.clickPosition

Number

No

Position where the user clicked. Defaults to displayPosition if omitted.

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total result count

sorting

String

No

Current sorting method

facets

Array

No

Active filters

source

String

No

Default: 'search-listing'. Set to 'search-popup' for search popup

traceId

String

No

On the listing page, this is handled automatically.

SDK add-to-cart methods do not trigger a click event automatically. When a user clicks the "Add to Cart" button directly on a product card in the search results page, you must call productClickAfterSearch first, then productAddToCartAfterSearch.

displayPosition refers to the position where the user first saw the product for a given query. After facet or sorting changes, the same product may appear in a different position. In this case, displayPosition (original position) and clickPosition (position at the time of click) may differ.

Example:

Insider.eureka.track.productClickAfterSearch(999999, 'queryA', {
    pagination: { resultCount: 25 },
    product: {
        id: 'product-001',
        price: 999.99,
        displayPosition: 2,
        clickPosition: 3,
    },
});

productAddToCartAfterListing

Call this when a user adds a product to cart directly from a category or brand listing page (not from the Product Details Page).

  • Method: Insider.eureka.track.productAddToCartAfterListing(campId, listingPageName, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID

listingPageName

String

Same page name used in the preceding productListingView call

payload

Object

Event data (see below)

  • Payload Fields:

Field

Type

Required

Description

product

Object

Yes

The product added to cart

product.id

String

Yes

Product identifier

product.price

Number

Yes

Product price

product.groupCode

String

No

Product variant group code

product.displayPosition

Number

No

Position where the product was displayed

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total result count

sorting

String

No

Current sorting method

facets

Array

No

Active filters

source

String

No

Default: 'category-listing'. Set to 'brand-listing' for brand pages

traceId

String

No

On the listing page, this is handled automatically.

You must call productClickAfterListing before calling this method.

Add-to-cart on the Product Details Page is collected automatically. Do not call this method on the Product Details Page.

Insider.eureka.track.productAddToCartAfterListing(470, 'categoryA~categoryB', {
    pagination: { resultCount: 84 },
    product: {
        id: 'product-001',
        price: 1299.99,
        displayPosition: 3,
    },
});

productAddToCartAfterSearch

Call this when a user adds a product to cart directly from the search results page (not from the Product Details Page).

  • Method: Insider.eureka.track.productAddToCartAfterSearch(campId, query, payload)

Parameter

Type

Description

campId

Number or String

Campaign/Builder ID

query

String

The search query that led to this action

payload

Object

Event data (see below)

  • Payload Fields:

Field

Type

Required

Description

product

Object

Yes

The product added to cart

product.id

String

Yes

Product identifier

product.price

Number

Yes

Product price

product.groupCode

String

No

Product variant group code

product.displayPosition

Number

No

Position where the product was displayed

product.clickPosition

Number

No

Position where the user clicked. Defaults to displayPosition if omitted.

pagination

Object

No

Pagination information

pagination.resultCount

Number

Yes

Total result count

sorting

String

No

Current sorting method

facets

Array

No

Active filters

source

String

No

Default: 'search-listing'. Set to 'search-popup' for search popup

traceId

String

No

On the listing page, this is handled automatically.

You must call productClickAfterSearch before calling this method.

Add-to-cart on the Product Details Page is collected automatically. Do not call this method on the Product Details Page.

Example:

Insider.eureka.track.productAddToCartAfterSearch(999999, 'queryA', {
    pagination: { resultCount: 25 },
    product: {
        id: 'product-001',
        price: 999.99,
        displayPosition: 2,
    },
});

Automatically Collected Logs

The following events are collected automatically. You do not need to call any track method for these.

Event

When it happens

Add to Cart

(on Product Details Page)

When a user adds a product to cart from the Product Details Page. Insider One automatically detects if the product was previously viewed through Eureka search or listing, and sends the event.

Purchase

When a user completes checkout on the post-payment (success) page. Insider One automatically matches purchased products with those previously accessed through Eureka and sends the event.

What you need to do:

Call the click track methods on listing and search pages whenever an item is clicked. For add-to-cart, call the track method only when the user adds a product to cart directly from the listing or search page (e.g. via an "Add to Cart" button on the product card). We handle add-to-cart on the Product Details Page and purchase events automatically.

Important Rules

  • Re-call on user interactions: Every time a user changes sorting, applies filters (facets), or uses pagination, you must call the corresponding track method again with the updated data.

  • Click before Add to Cart: Always call the click method (productClickAfterListing or productClickAfterSearch) before calling the add-to-cart method. The add-to-cart method does not trigger a click event automatically.

  • Product Details Page handling: Add-to-cart on the Product Details Page and purchase events are automatically collected. Do not call track methods for these scenarios. Only call track methods on listing and search pages.

  • traceId on Product Details Page: If you need to send a click or add-to-cart log from the Product Details Page (instead of the listing/search page), you must provide the traceId in the payload. On listing/search pages, traceId is managed automatically.

TraceId

traceId is a unique identifier used to deduplicate events and ensure they are counted correctly in analytics.

For example, when a user searches for "queryA" and sees 10 products, the search event sends all 10 products. Each of these is stored as a separate record, but because they share the same traceId, Eureka Analytics groups them and counts them as a single search action.

The same applies to listing pages: when a category page shows 25 products, they all share the same traceId and are counted as one page view in the analytics dashboard.

How the SDK manages traceId automatically

In most cases, you do not need to provide traceId; the SDK generates and reuses it automatically

Event

TraceId Behavior

productListingView

Always generates a new traceId for each call

search

Generates a new traceId when the query changes. Reuses the same traceId when the same query is searched again (e.g., pagination, sorting, facet changes)

productClickAfterListing

Automatically reuses the traceId from the last productListingView call

productClickAfterSearch

Automatically reuses the traceId from the last search call

productAddToCartAfterListing

Same behavior as productClickAfterListing

productAddToCartAfterSearch

Same behavior as productClickAfterSearch

Generate a traceId:

const traceId = Insider.eureka.track._generateTraceId();

Example - Click on Product Details Page with stored traceId:

Insider.eureka.track.productClickAfterListing(campId, 'categoryA~categoryB', {
    traceId: storedTraceId,  // retrieved from SDK _generateTraceId method
    pagination: { resultCount: 84 },
    product: {
        id: 'product-001',
        price: 1299.99,
        displayPosition: 3,
    },
});

On listing/search pages, traceId is handled automatically. On the Product Details Page, if no traceId is provided on the Product Details Page, the SDK generates a new one, meaning the event will be counted as a separate action instead of being grouped with the originating search or listing.

Source Values

The source field indicates which page type the log comes from. If not provided, the SDK uses default values.

Source Value

Description

category-listing

Category listing page (default for listing methods)

search-listing

Search results page (default for search methods)

brand-listing

Brand listing page

search-popup

Search popup (search in a modal)

When to override

  • For brand listing pages, set source: 'brand-listing' in the payload of listing methods.

  • For search popup, set source: 'search-popup' in the payload of search methods.

Example:

// Brand listing page view
Insider.eureka.track.productListingView(470, 'BrandName', {
    source: 'brand-listing',
    products: [{ id: 'product-001', price: 999.99 }],
    pagination: { resultCount: 50 },
});

// Search in popup
Insider.eureka.track.search(999999, 'queryA', {
    source: 'search-popup',
    products: [{ id: 'product-001', price: 999.99 }],
    pagination: { resultCount: 10 },
});

Validations

Track methods validate the payload before sending. If validation fails, a warning is logged.

Event Type

Validated Field

Expected Type

Condition

All events

pagination.resultCount

Number

Always

Listing view

listingPageName

String

Always

Listing view

products

Array

Always

Listing view

products[].id

String

For each product

Listing view

products[].price

Number

For each product

search

query

String

Always

search

products

Array

Always

search

products[].id

String

For each product

search

products[].price

Number

For each product

Click / Add to Cart

product

Object

Always

Click / Add to Cart

product.id

String

Always

Click / Add to Cart

product.price

Number

Always

Click / Add to Cart (listing)

listingPageName

String

Only when source is 'category-listing' or 'brand-listing'

Click / Add to Cart (search)

query

String

Only when source is 'search-listing' or 'search-popup'

Validation Error Message Format

{fieldPath} must be {expectedType} for log type {eventType}

Examples:

  • products[0].id must be string for log type collection

  • product.price must be number for log type product-click