Recent Searches Support

Profile Tag offers recent searches support that you can integrate with your storefront to show user their most recent search phrases.

Profile Tag utilizes browser local storage to retain user search queries, ensuring that this data remains accessible even if the user closes their browser.

Within the window.Y_TRACKING.recentSearches object, Profile Tag provides a set of functions related to recent searches:
  • getPhrases() - returns the list of single user's recent search phrases. The list is sorted in descending order with the newest search phrases at the top and contains up to 5 elements. You can change the limit by defining the max number value in local storage under - {site}-recentSearchHistorySize - where {site} refers to commerce base site identifier.

  • removePhrase(searchPhrase) - removes given search phrase from single user's stored search phrases list.

  • clearPhrases() - clears the single user's search phrases list.

  • addListener(callbackMethod) - registers the search phrases listener. Profile Tag invokes the given callback function on each change of single user's recent search phrases list. The callback function receives the entire search phrases list as the first method argument.

  • removeListener() - removes the search phrases listener.

  • updatePhrases(searchPhrase) - stores information about given search phrases in browser local storage. If Profile Tag is properly configured to process keyword search events, there is no need to use this function.

For more information on the recent searches support in composable storefront, see Recent Searches.

Data Privacy

The recent searches support feature relies on data provided by the user, so it's important to keep the following points in mind:
  • The list of recently searched phrases provided by this API (referred to as data in this context) is stored on the user's end device, specifically in the browser storage. As a result:
    • SAP has no access to this data and doesn't offer data retrieval functionality.

    • Only the user has the authority to modify this information.

    • The data remains inaccesible on other devices, even if the user logs into their account.

  • The data is only collected when the user grants their consent.

  • The data is removed when the user revokes their consent.

    • For the authenticated users, the data is automatically removed from all devices upon revisiting the website.

    • For the the anonymous users, the data is removed only from the device where the data has been stored.

  • It is possible to remove individual or all search phrases using the appropriate API calls - whether this functionality will be accessible in the storefront's UI is determined by the storefront implementor.