Implementation Order

The recommended sequence for building a full Athos integration from scratch — what to set up first, what depends on what, and what's optional.

🏗️ Build in the Right Order

Getting the sequence right saves debugging time. Several things in Athos have hard dependencies: cookies must exist before API calls fire, responseId must be captured before tracking events can attach to it, and Shopping Platform events must be flowing before Recommendations or Personalization are meaningful. This guide walks the full build sequence from setup to production-ready.


✅ Step 1 — Cookies

Set these cookies on every page load, before any API calls are made.

❗️

Using Snap, Beacon.js or the Shopify Pixel tracking? Cookie setup is not required for Snap, Beacon.js or Shopify Pixel tracking. These libraries will handle the generation of the tracking cookies.

User Tracking Cookies (Required for all integrations)

CookieExpirationPurpose
athosUserId1 yearPersistent user identifier. Generate once, store forever.
athosSessionIdSession (tab lifecycle)New UUID per session, stored in sessionStorage

Both values must be UUID v4 format. See UUID v4 Generation →

🚨

Migrating from Searchspring? _isuid is the deprecated legacy cookie from IntelliSuggest tracking. If it exists in your implementation, it must share the same UUID value as athosUserId. New integrations do not need to set _isuid.

💡

athosSessionId follows sessionStorage behavior: it persists while the tab is open (including page reloads), but each new tab gets its own session ID and it clears when the tab is closed.

Personalization Tracking Cookies (Required if using Personalized Search & Merchandising or Recommendations)

CookieExpirationMaps to API param
athosShopperIdSessionshopper
athosCartProductsSessioncart
athosViewedProducts7 yearslastViewed

Set the cookie first. The API query string parameters source their values from these cookies.

See Athos Cookies →


✅ Step 2 — Beacon Tracking

Initialize your tracker before any user interaction can happen. Tracking is the backbone of analytics, personalization, and recommendations. The earlier it's live, the more data you accumulate.

Beacon 2.0 is the Athos tracking event system — the standard for what events to send and how. It covers all core event types: autocomplete, search, category, recommendations, and shopping platform events (product views, cart, orders).

There are two ways to implement it:

Beacon.jsDirect Beacon 2.0 API
What it isTypeScript library wrapping the Beacon 2.0 APIHTTP calls sent directly to the Beacon 2.0 endpoints
ProsHandles batching, storage management, and attribution automaticallyNo library dependency, full control, works in any environment
ConsAdds a library dependencyYou manage batching, storage, and attribution yourself
InstallNPM or CDNNo install required
Best forClient-side and SPA integrationsServer-side integrations or teams with specific requirements

If using Beacon 2.0 API

  • Build a shared context object utility (every beacon event requires it):
{
  "context": {
    "timestamp": "2024-06-11T17:47:04.075876Z",
    "pageUrl": "https://yourstore.com/search?q=jacket",
    "userId": "<athosUserId cookie value>",
    "sessionId": "<athosSessionId cookie value>",
    "pageLoadId": "<UUID v4 — generate once per page load, reuse across events>",
    "initiator": "yourcompany/custom/1.0"
  }
}

Why choose Beacon.js? Beacon.js handles all of the tracking cookies and storage automatically AND preflight calls when those parameters change.

📘

Every Search, Autocomplete, and Recommendations API response includes a responseId. Capture it from each response and pass it with all beacon events for that interaction — it ties shopper behavior back to the specific API response that produced it. responseId is only returned when beacon=true is included in the request.

See Beacon Tracking → · Beacon.js →


✅ Step 3 — Autocomplete

Autocomplete is the entry point to search. Users type, suggestions fire, queries form. Wire this up before Search so the full query flow is tracked from the start.

API setup — three endpoints work together:

  • Trending API (optional): call on search bar focus, before the shopper types, to show popular searches
  • Suggest API: call as the shopper types (recommended: after 2+ characters with a 50ms debounce) to fetch query suggestions
  • Autocomplete API: call with the current query (or hovered suggestion) to fetch product previews; use this endpoint, not the Search API, for autocomplete product results
🚨

You must use the Autocomplete API endpoint (not Search) for autocomplete product results. Using the Search endpoint instead causes inaccurate reporting.

Required query string params on every Autocomplete API request: userId, sessionId, pageLoadId, domain (from window.location.href), and beacon=true

For accurate reporting, also pass:

  • source — where the query came from: suggested, historical, trending, or input (default when user types freely)
  • input — what the user actually typed, which may differ from q when the user hovers or selects a suggestion
📘

Every API response includes a responseId. Capture it and pass it with all beacon tracking events for that interaction — it's what ties shopper behavior back to the specific API response that produced it.

Store the responseId from each response.

Tracking events to wire up alongside the API:

EventWhen to FireKey Required Fields
renderAutocomplete results are rendered in the dropdownresponseId
impressionResults or banners become visible in the dropdownresponseId, results, banners
clickthroughShopper clicks a result or banner (navigates to PDP)responseId, exactly 1 result or banner
redirectAutocomplete returns a redirect URL and shopper is redirectedresponseId, redirect
addtocartShopper uses Quick Add to Cart in the dropdown (if implemented)responseId, results with qty and price

All events sent to: https://analytics.athoscommerce.net/beacon/v2/{siteId}/autocomplete/[event]

Merchandising Features

Merchandising data comes back inside the Autocomplete API response. No separate API call is needed. This step is purely about rendering and tracking what the API already returns.

Banners (inline + hero):

  • Check the response for merchandising.content (inline banners within results)
  • Check for merchandising.banner (banners located outside of results grid i.e header/footer etc.)
  • Track banner impressions and clicks

Did You Mean:

  • Check didYouMean. If present and results are sparse, surface the corrected query suggestion

See Autocomplete → · Beacon Tracking → · Integrating Banners →


✅ Step 4 — Search + Category

Search and Category use nearly identical API patterns: same required params, same response shape, same beacon=true requirement. Implement and track them together.

API setup:

  • Required query string params on every request: userId, sessionId, pageLoadId, domain (from window.location.href)
  • For Search: pass q with the submitted search query
  • For Category: pass bgfilter with the category identifier — this is required to define the category scope and differentiate it from customer-applied filters
  • Store the responseId from each response

Required for correct reporting and merchandising:

  • Do not apply a default sort on initial page load. Let Athos return results in their natural order so merchandising rules and relevancy work as configured.
  • Do not filter, sort, or paginate client-side. All of these must go through the API — client-side manipulation breaks reporting and bypasses merchandising rules.

Search tracking events:

EventWhen to FireKey Required Fields
renderSearch results page loads and results are renderedresponseId
impressionResults or banners scroll into the shopper's viewresponseId, results, banners
clickthroughShopper clicks a result or banner (navigates to PDP)responseId, exactly 1 result or banner
redirectSearch returns a redirect URL and shopper is redirectedresponseId, redirect
addtocartShopper uses Quick Add to Cart on the results page (if implemented)responseId, results with qty and price

All search events sent to: https://analytics.athoscommerce.net/beacon/v2/{siteId}/search/[event]

Category tracking events:

EventWhen to FireKey Required Fields
renderCategory page loads and results are renderedresponseId
impressionResults or banners scroll into the shopper's viewresponseId, results, banners
clickthroughShopper clicks a result or banner (navigates to PDP)responseId, exactly 1 result or banner
addtocartShopper uses Quick Add to Cart on the category page (if implemented)responseId, results with qty and price

All category events sent to: https://analytics.athoscommerce.net/beacon/v2/{siteId}/category/[event]

Merchandising Features

Merchandising data comes back inside the Search, and Category API responses. No separate API call is needed. This step is purely about rendering and tracking what the API already returns.

Banners (inline + hero):

  • Check the response for merchandising.content (inline banners within results)
  • Check for merchandising.banner (banners located outside of results grid i.e header/footer etc.)
  • Track banner impressions and clicks

Redirect:

  • Check merchandising.redirect. If present, navigate the user to that URL instead of rendering results

Did You Mean:

  • Check didYouMean. If present and results are sparse, surface the corrected query suggestion

See Search → · Category → · Search Tracking → · Category Tracking → · Integrating Banners →


✅ Step 5 — Products API

The Products API returns full variant-level data for a given parent product — images, prices, SKUs, availability, options (color, size), badges, and display attributes. Call it when a shopper navigates to a PDP or triggers a quick view overlay.

Endpoint: GET /v1/products/{parentId}

When to call it:

  • On every PDP load, using the parentId from the search or category result the shopper clicked
  • On quick view overlays in search or category grids (if implemented)

What it returns:

  • variants.data — the full list of variants with their options, pricing, images, and availability
  • variants.optionConfig — the option structure (e.g., color as swatch, size as dropdown) to drive your variant selector UI
  • mappings.core.description — the product description
📘

The Search and Category APIs already return variant data inline in their responses. The Products API is for when you need the full variant dataset on a PDP or quick view, beyond what the search result included.

See Products API →


✅ Step 6 — Shopping Platform Events

These events capture core commerce behavior and are required for Personalization and Reporting. The Recommendations engine needs product/pageview and order/transaction data flowing before it can generate meaningful results.

Optionally implement these using Beacon.js directly, or — if you're on Shopify — the Shopify Web Pixel can handle them automatically in place of manual implementation.

EventWhen to FireNotes
product/pageviewOn every Product Detail Page (PDP)Required for Personalization and Reporting
cart/addWhen an item is added to cart or quantity increasedRequired for email and SMS recommendations
cart/removeWhen an item is removed from cart or quantity decreasedRequired for email and SMS recommendations
order/transactionOn the order confirmation pageRequired for Personalization and Reporting
shopper/loginWhen a user successfully authenticatesshopperId required for Personalization
👍

Shopify Web Pixel users: product/pageview, cart/add, cart/remove, and order/transaction are handled automatically by the Pixel. You do not need to implement these manually via Beacon.js. All other tracking events (autocomplete, search, category, recommendations) still require Beacon.js.

These events also trigger Preflight calls in Step 8.

See Beacon Tracking →


✅ Step 7 — Personalization / Preflight (Optional — account feature)

🚧

This step is only required if your Athos account has Personalized Search & Merchandising enabled. Contact your Athos point of contact if you're unsure.

📘

This step is NOT required if you are using the Shopify Web Pixel or Beacon.js The Shopify Web Pixel and Beacon.js libraries handle these preflight requests when event methods are called eg. beacon.events.product.pageView

The Preflight API primes Athos's personalization cache ahead of Search, Autocomplete, and Recommendations requests, improving response times and result relevance.

When to call Preflight:

☎️

Calling the Preflight API When using the Preflight API any time lastViewed, cart, or shopper changes, Preflight should fire.

TriggerWhat Changed
User views a PDPlastViewed updated
User adds/removes from cartcart updated
User logs inshopper ID established

Required params: siteId, userId Optional params: shopper, cart, lastViewed

The response can be ignored. Its only purpose is to notify Athos so personalization data is cached before the next API call.

See Personalization →


✅ Step 8 — Recommendations (Optional — account feature)

🚧

Personalized Recommendations require a plan upgrade. product/pageview and order/transaction beacon events (Step 6) must be live and collecting data before Recommendations will produce meaningful results.

API setup:

  • Use POST /recommend (preferred) or GET /recommend
  • Pass profile tags, products (for cross-sell on PDPs), and beacon=true
  • Pass shopper, cart, and lastViewed for personalized results
  • Store the responseId from each response
💡

tag is the recommendation profile identifier (e.g., similar, trending, recently-viewed, bought-together). It's required on all recommendation events. Each recommendation event should be sent on a per page basis NOT per profile. This improves page load speeds and allows our service to dedupe results.

Tracking events to wire up alongside the API:

EventWhen to FireKey Required Fields
renderRecommendations are requested from the API and rendered on the pagetag, responseId
impressionRecommended products or banners scroll into the shopper's viewtag, responseId, results, banners
clickthroughShopper clicks a recommended product or banner (navigates to PDP)tag, responseId, exactly 1 result or banner
addtocartShopper uses Quick Add to Cart on a recommendation (if implemented)tag, responseId, results with qty and price

All recommendations events sent to: https://analytics.athoscommerce.net/beacon/v2/{siteId}/recommendations/[event]

💡

Recommendations improve as behavioral data accumulates. Results may appear sparse or generic in the first days after launch. This is expected.

See Recommendations → · Recommendations Tracking →


✅ Step 9 — Segmented Merchandising (Optional — account feature)

Segmented Merchandising allows you to pass customer segment data with Search and Category requests to receive segment-specific merchandising rules. Implement this after core search and merchandising are stable.

See Segmented Merchandising →


📋 Summary

StepWhatRequired
1Cookies (athosUserId, athosSessionId)
2Beacon.js + context object
3Autocomplete — API + tracking + banners
4Search + Category — API + tracking + banners
5Products API — PDP and quick view variant data
6Shopping Platform Events via Beacon.js (or Shopify Web Pixel)
7Personalization / PreflightOptional
8Recommendations — API + trackingOptional
9Segmented MerchandisingOptional

For a detailed checklist with checkboxes, see the API Integration Checklist →