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)
| Cookie | Expiration | Purpose |
|---|---|---|
athosUserId | 1 year | Persistent user identifier. Generate once, store forever. |
athosSessionId | Session (tab lifecycle) | New UUID per session, stored in sessionStorage |
Both values must be UUID v4 format. See UUID v4 Generation →
Migrating from Searchspring?
_isuidis the deprecated legacy cookie from IntelliSuggest tracking. If it exists in your implementation, it must share the same UUID value asathosUserId. New integrations do not need to set_isuid.
athosSessionIdfollows 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)
| Cookie | Expiration | Maps to API param |
|---|---|---|
athosShopperId | Session | shopper |
athosCartProducts | Session | cart |
athosViewedProducts | 7 years | lastViewed |
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.js | Direct Beacon 2.0 API | |
|---|---|---|
| What it is | TypeScript library wrapping the Beacon 2.0 API | HTTP calls sent directly to the Beacon 2.0 endpoints |
| Pros | Handles batching, storage management, and attribution automatically | No library dependency, full control, works in any environment |
| Cons | Adds a library dependency | You manage batching, storage, and attribution yourself |
| Install | NPM or CDN | No install required |
| Best for | Client-side and SPA integrations | Server-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.responseIdis only returned whenbeacon=trueis 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, orinput(default when user types freely)input— what the user actually typed, which may differ fromqwhen 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:
| Event | When to Fire | Key Required Fields |
|---|---|---|
render | Autocomplete results are rendered in the dropdown | responseId |
impression | Results or banners become visible in the dropdown | responseId, results, banners |
clickthrough | Shopper clicks a result or banner (navigates to PDP) | responseId, exactly 1 result or banner |
redirect | Autocomplete returns a redirect URL and shopper is redirected | responseId, redirect |
addtocart | Shopper 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(fromwindow.location.href) - For Search: pass
qwith the submitted search query - For Category: pass
bgfilterwith the category identifier — this is required to define the category scope and differentiate it from customer-applied filters - Store the
responseIdfrom 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:
| Event | When to Fire | Key Required Fields |
|---|---|---|
render | Search results page loads and results are rendered | responseId |
impression | Results or banners scroll into the shopper's view | responseId, results, banners |
clickthrough | Shopper clicks a result or banner (navigates to PDP) | responseId, exactly 1 result or banner |
redirect | Search returns a redirect URL and shopper is redirected | responseId, redirect |
addtocart | Shopper 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:
| Event | When to Fire | Key Required Fields |
|---|---|---|
render | Category page loads and results are rendered | responseId |
impression | Results or banners scroll into the shopper's view | responseId, results, banners |
clickthrough | Shopper clicks a result or banner (navigates to PDP) | responseId, exactly 1 result or banner |
addtocart | Shopper 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
parentIdfrom 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 availabilityvariants.optionConfig— the option structure (e.g., color as swatch, size as dropdown) to drive your variant selector UImappings.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.
| Event | When to Fire | Notes |
|---|---|---|
product/pageview | On every Product Detail Page (PDP) | Required for Personalization and Reporting |
cart/add | When an item is added to cart or quantity increased | Required for email and SMS recommendations |
cart/remove | When an item is removed from cart or quantity decreased | Required for email and SMS recommendations |
order/transaction | On the order confirmation page | Required for Personalization and Reporting |
shopper/login | When a user successfully authenticates | shopperId required for Personalization |
Shopify Web Pixel users:
product/pageview,cart/add,cart/remove, andorder/transactionare 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.
✅ 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, orshopperchanges, Preflight should fire.
| Trigger | What Changed |
|---|---|
| User views a PDP | lastViewed updated |
| User adds/removes from cart | cart updated |
| User logs in | shopper 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.
✅ Step 8 — Recommendations (Optional — account feature)
Personalized Recommendations require a plan upgrade.
product/pageviewandorder/transactionbeacon events (Step 6) must be live and collecting data before Recommendations will produce meaningful results.
API setup:
- Use
POST /recommend(preferred) orGET /recommend - Pass profile
tags,products(for cross-sell on PDPs), andbeacon=true - Pass
shopper,cart, andlastViewedfor personalized results - Store the
responseIdfrom each response
tagis 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:
| Event | When to Fire | Key Required Fields |
|---|---|---|
render | Recommendations are requested from the API and rendered on the page | tag, responseId |
impression | Recommended products or banners scroll into the shopper's view | tag, responseId, results, banners |
clickthrough | Shopper clicks a recommended product or banner (navigates to PDP) | tag, responseId, exactly 1 result or banner |
addtocart | Shopper 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.
📋 Summary
| Step | What | Required |
|---|---|---|
| 1 | Cookies (athosUserId, athosSessionId) | ✅ |
| 2 | Beacon.js + context object | ✅ |
| 3 | Autocomplete — API + tracking + banners | ✅ |
| 4 | Search + Category — API + tracking + banners | ✅ |
| 5 | Products API — PDP and quick view variant data | ✅ |
| 6 | Shopping Platform Events via Beacon.js (or Shopify Web Pixel) | ✅ |
| 7 | Personalization / Preflight | Optional |
| 8 | Recommendations — API + tracking | Optional |
| 9 | Segmented Merchandising | Optional |
For a detailed checklist with checkboxes, see the API Integration Checklist →