Skip to main content
Layers uses lightweight session context to deliver personalized search experiences. By understanding what customers have viewed, purchased, searched for, and where they’re located, the platform can surface more relevant products and optimize merchandising decisions in real-time.

How contextual information works

Contextual information is automatically collected and managed by the Storefront Pixel 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. This allows Layers to recognize returning visitors even when they’re not signed in, enabling 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. Sessions typically expire after a period of inactivity or when the user closes their browser (depending on Shopify’s session management). Source: Shopify session ID, available via Liquid template variables.

Customer ID

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

See also