In all Searchspring integrations the User Tracking cookies are required for various API endpoints to primarily allow our reporting to function properly. If you are signed up for Personalized Recommendations and/or Personalized Search & Merchandising the Personalization Tracking cookies are required to be set.

User Tracking


We strongly recommend the values for these cookies be set immediately when a shopper navigates to the website, and the values are supplied by a UUID v4 generator. These recommendations are called out to prevent gaps in reporting and also to ensure the cookie values are unique.


CookiesExpiration
_isuid1 year
ssUserId1 year
ssSessionIdNamespacesession

Note: it is required the _isuid and ssUserId cookies share the same value.




Personalization Tracking


We strongly recommend the values for the following query string parameters used for Personalized Recommendations and Personalized Search & Merchandising are stored as cookies. Should you require technical assistance with any personalization issues this will allow our internal teams to more easily diagnose and relay the issue, however, you can store these values any way you choose to do so.


The cookie should be set first and the query string parameters should receive their value from the stored cookie.


Below is a table that will showcase the strongly recommended naming convention for the cookies, and the mapping between the stored cookie and where the query string parameter sources it’s value.


CookiesExpirationQuery String Parameters
ssShopperIdsession➡️shopper
ssCartProductssession➡️cart
ssViewedProducts7 years➡️lastViewed

See our API references below to view how the Personalization Tracking cookies should source their values, which are then mapped to the query string parameters shopper, cart, and lastViewed.

Endpoints that use Personalization Query String Parameters




FAQs

Q: What is the difference between _isuid and ssUserId?

  A: _isuid is used for IntelliSuggest tracking, and ssUserId is used for all other API endpoints where userId is referenced.

Q: How does Searchspring determine when a session expires?

  A: The way Searchspring determines a session length is based on a visit to the site, which is typically the life span of the browser tab.

  A: The way Searchspring determines a session length is based on MDN Web Docs sessionStorage. Below is the criteria.

  • Whenever a document is loaded in a particular tab in the browser, a unique page session gets created and assigned to that particular tab. That page session is valid only for that particular tab.
  • A page session lasts as long as the tab or the browser is open, and survives over page reloads and restores.
  • Opening a page in a new tab or window creates a new session with the value of the top-level browsing context.
  • Opening multiple tabs/windows with the same URL creates sessionStorage including ssSessionIdNamespace for each tab/window.
  • Duplicating a tab copies the tab's sessionStorage including ssSessionIdNamespace into the new tab.
  • Closing a tab/window ends the session and clears objects in sessionStorage including ssSessionIdNamespace.
<!-- Include the uuid library -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/uuidv4.min.js"></script>
<script>
  function initializeSessionIdNamespace() {
    var sessionKey = "ssSessionIdNamespace";

    // Log current sessionStorage for debugging purposes
    console.log("Current sessionStorage value:", sessionStorage.getItem(sessionKey));

    // Check if the ssSessionIdNamespace is already set in sessionStorage
    if (!sessionStorage.getItem(sessionKey)) {
      console.log("ssSessionIdNamespace not found, creating a new one...");
      // Generate a new UUID (ensure uuidv4 is properly loaded in your environment)
      var uuid = uuidv4();
      sessionStorage.setItem(sessionKey, uuid);
      document.cookie = sessionKey + "=" + uuid + "; path=/; SameSite=Lax";
    }

    // Log the sessionId after ensuring it has been set
    var sessionId = sessionStorage.getItem(sessionKey);
    console.log("Session ID for this tab:", sessionId);
  }

  // Run the function when the page loads
  window.addEventListener("load", initializeSessionIdNamespace);
</script>