Skip to content

Event API

POST
View MD

The Events API accepts structured JSON events that describe what users see, click, and buy. It is the right choice when you need to send analytics from a backend, mobile app, native application, or a custom frontend that should not rely on the browser collector.

Luigi’s Box currently supports these event patterns in v1:

  • Page and detail views via pv
  • Search, autocomplete, listing, and recommendation impressions via event
  • Clicks and micro-conversions via click
  • Completed purchases via transaction

Use the Events API when:

  • You are integrating Luigi’s Box in a mobile application
  • You need server-side control over event delivery
  • You want to send analytics from a custom frontend implementation

Every event shares the same top-level envelope. The event type determines which additional payload keys are required.

ParameterTypeRequiredDescription
typeStringEvent type such as pv, event, click, or transaction.
tracker_idStringYour Luigi’s Box tracker ID.
client_idString or IntegerStable anonymous identifier for the current browser, device, or app install.
idStringGlobally unique identifier for this event. A UUID is recommended.
customer_idString or IntegerYour logged-in user identifier. Send it together with client_id when available.
local_timestampIntegerUNIX timestamp in seconds. Do not send milliseconds.
platformString or ArrayPlatform identifier such as iOS, Android, or desktop. You can also send [platform, version].
user_agentStringBrowser or app user agent string.
refererStringPrevious page URL if available.
contextObjectContext values that match your indexed catalog context, for example warehouse or market.
ab_test_variantStringSession-level A/B variant name such as Original or Luigis.
consent_grantedBooleanSet true when the user granted consent for personalization.
recommendation_idStringRecommendation batch identifier used mainly for email/newsletter attribution.
  • Keep client_id stable for the same browser or device, even if the user logs in or logs out.
  • Add customer_id only when the user is authenticated.
  • Use the same product or object identity here as in your indexing data. See Object identity.

Use pv to report page views and detail views.

  • For a catalog detail page, send the indexed object identity in url
  • For a generic page view, send the canonical page URL or path in url
ParameterTypeRequiredDescription
typeStringMust be pv.
urlStringObject identity for a catalog detail page, or canonical page URL/path for a generic page view.
titleStringHuman-readable page or object title for analytics presentation.

This event is the foundation of journey tracking. It tells Luigi’s Box what the user viewed before they searched, clicked, converted, or purchased.

Report full-text search interactions with a list event whose key is exactly Search Results.

ParameterTypeRequiredDescription
typeStringMust be event.
listsObjectContainer for the reported lists.
lists["Search Results"]ObjectThe search results list. The list name is case-sensitive.
lists["Search Results"].query.stringStringThe exact user query.
lists["Search Results"].query.filtersObjectActive search filters, sort values, _Guid, and _Variant.
lists["Search Results"].itemsArrayThe visible search results returned to the user.
FieldTypeRequiredDescription
titleStringDisplay title of the result.
typeStringCatalog object type such as item, category, or article.
urlStringIndexed object identity.
positionIntegerAbsolute position in the full result set. Keep it cumulative across pagination.
priceFloatDisplayed price if relevant.
  • Use _Guid to send the guid from the Search API response
  • Use _Variant to report the list-level A/B variant
  • Include active filter and sort values exactly as the user sees them

Use event with a list named exactly Autocomplete to report what the user saw in the autocomplete dropdown.

ParameterTypeRequiredDescription
typeStringMust be event.
lists.Autocomplete.query.stringStringThe text currently typed by the user.
lists.Autocomplete.query.filtersObjectOptional filters. Include _Guid when the autocomplete response provides one.
lists.Autocomplete.itemsArraySuggestions shown to the user.

Autocomplete items use the same core fields as search results:

  • title
  • type
  • url
  • position
  • optional price

If your empty-state autocomplete shows Top Items on focus, do not track it as Autocomplete. Track it as a Recommendation event and set both Recommender and RecommenderClientId to autocomplete_popup.

Use event with a list named exactly Product Listing to report category pages, brand pages, campaign landing pages, or other browse-first listing experiences.

ParameterTypeRequiredDescription
lists["Product Listing"].itemsArrayVisible products in the listing.
lists["Product Listing"].query.filtersObjectActive filters, sorting, _Guid, and _Variant.
lists["Product Listing"].query.scopesObjectListing context such as category or brand.
  • For categories, send _category_label and _category_identity
  • For brands, send _brand_label and _brand_identity

As with search, positions must be absolute across paginated results.

Use event with a list named exactly Recommendation whenever a recommendation widget is shown.

Filter keyRequiredDescription
RecommenderClientIdStable identifier of the recommender placement, such as homepage_top or item_detail_alternatives.
RecommendationIdStrongly recommendedUnique identifier of the returned recommendation set. Required for all new integrations.
ItemIdsInput item identities used to generate the recommendation.
RecommenderLuigi’s Box recommender name from the response.
TypeRecommendation type from the response.
_VariantA/B test variant for this list.

RecommendationId allows Luigi’s Box to attribute later clicks and purchases to the exact recommendation set that generated them. For new integrations, treat it as mandatory.

Send a click event whenever a user clicks a search result, autocomplete suggestion, or recommendation.

ParameterTypeRequiredDescription
typeStringMust be click.
action.typeStringMust be click.
action.resource_identifierStringIdentity of the clicked object. If the clicked result is of type query, send its title instead.

Luigi’s Box uses resource_identifier to attribute the click to previously reported lists.

Micro-conversions use the same outer event type as clicks.

  • Keep type set to click
  • Use an action.type other than click, such as add-to-cart, add-to-wishlist, or buy
  • Set action.resource_identifier to the same object identity used in your catalog and list events

Send conversion events from every place where the action can happen, including list pages and detail pages. Luigi’s Box scans the earlier event stream backwards to attribute the conversion to prior search, autocomplete, product listing, or recommendation impressions.

Use transaction to report completed purchases.

ParameterTypeRequiredDescription
typeStringMust be transaction.
itemsArrayAll purchased line items in the order.
FieldTypeRequiredDescription
urlStringIndexed identity of the purchased object.
countIntegerQuantity purchased.
total_priceFloatFinal line-item price after quantity and discounts are applied.
titleStringHuman-readable title for reporting.
was_discountedBooleanSet true when the line item was discounted below the catalog price.
was_volume_discountedBooleanSet true when a quantity-based discount was applied.

Include every purchased item in the order, not only the ones previously touched by Luigi’s Box lists. Luigi’s Box handles attribution after ingesting the transaction.

HTTP statusMeaning
400 Bad RequestInvalid JSON or invalid event structure.
413 Payload Too LargeRequest is too large. Reduce payload size or enable compression.
429 Too Many RequestsRate limit exceeded. Respect Retry-After and retry later.
  • Maximum 30 events per 15 seconds for a given client_id
  • Maximum 400 events per session
  • Sessions expire after 30 minutes of inactivity

If you exceed the rate limits, Luigi’s Box returns 429 Too Many Requests.