@blotoutio/providers-evo-search-sdk 1.71.0 → 1.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -312,6 +312,25 @@ Call `trackClick(productId)` when a user clicks a result, passing the `id` field
312
312
  }
313
313
  ```
314
314
 
315
+ ### Product views and cart contents — `trackProductView` / `setCartProductIds`
316
+
317
+ Search ranking can use what the shopper has been looking at this visit. The SDK reads the product page it is loaded on by itself, from the storefront platform's own page globals or the page's `Product` structured data, so a themed storefront needs no code. Two cases it cannot see, and both are one call:
318
+
319
+ ```tsx
320
+ import { trackProductView, setCartProductIds } from '@blotoutio/providers-evo-search-sdk/hooks'
321
+
322
+ // A product page whose markup publishes neither of those, or a client-side
323
+ // route change into one (no page load happens, so the SDK never re-runs).
324
+ useEffect(() => trackProductView(product.id), [product.id])
325
+
326
+ // The cart, as the COMPLETE current list of product ids — not a delta. The SDK
327
+ // will not fetch it: that would be a request from your storefront on a path the
328
+ // shopper is waiting on. Call this whenever the cart changes.
329
+ setCartProductIds(cart.lines.map((line) => line.productId))
330
+ ```
331
+
332
+ Both take the platform's numeric product id (string or number, the global-id form accepted too) — the same id space as `trackClick`. Both are plain `sessionStorage` writes: safe to call before the SDK has registered, they never throw, and the context dies with the tab. It leaves the browser only on search requests, and only when the merchant has the session-context option enabled.
333
+
315
334
  ### Add-to-cart / purchase — use your existing EdgeTag tags
316
335
 
317
336
  If you already send EdgeTag `AddToCart` and `Purchase` events via the EdgeTag SDK, you're done — EvoSearch receives them server-side and attributes them to searches automatically.