Skip to main content
Layers uses lightweight session context to personalize search. Using what customers have viewed, purchased, and searched for, where they’re located, and which Shopify Market they belong to, Layers surfaces more relevant products and adjusts merchandising in real time.

How contextual information works

The Storefront Pixel automatically collects and manages contextual information for standard Shopify integrations. For headless or custom implementations, you must manually include contextual data in your API requests to enable personalization features.

Standard Shopify integration

When you install the Layers Storefront Pixel on your Shopify theme, contextual information is automatically:
  • Collected from the customer’s browsing session and Shopify customer data
  • Transmitted with every search, browse, and tracking event
  • Used to personalize results without any additional implementation

Headless integration

For headless storefronts or custom implementations, you must:
  1. Collect relevant contextual information from your application
  2. Include it in the context parameter of your API requests
  3. Manage user identity through the identity parameter
  4. Pass geographic location explicitly when making server-side API calls (the platform cannot automatically determine location from server IP addresses)
See the Search API, Browse API, and Prepare Search API documentation for details on passing contextual information.

User identity

Layers uses three identifiers to track and personalize user experiences:

Device ID (browser ID)

A persistent identifier stored in the browser’s local storage that remains constant across sessions. The device ID lets Layers recognize returning visitors even when they’re not signed in, for long-term personalization and behavior tracking. Source: Generated by the Storefront Pixel on first visit and persisted in browser storage.

Session ID

A temporary identifier that represents a single browsing session. Layers-generated sessions use a rolling 30-minute inactivity window. The Storefront Pixel refreshes the window when a page loads and on every route change, including pages without tracked events. Legacy Shopify or fallback cookies remain preferred when present, and their lifetime is not controlled by Layers. Source: The Storefront Pixel’s Layers session cookie, or a sessionStorage/in-memory fallback when consent is unavailable.

Customer ID

The Shopify customer ID for authenticated users. The customer ID is only present when a customer is signed in to their account. Source: Shopify customer ID, available when customer exists in Liquid templates. The device ID, session ID, and customer ID are included in the identity parameter when making API requests. The Storefront Pixel handles this automatically for standard integrations.

See also