Search History

Prev Next

This function is used to get the past 10 queries that the user has made.

// Import the integration from the 'installation' step
import { integration } from './xgenSdkIntegration';
const { getSearchHistory } = integration;

getSearchHistory();

Params

None.

Response

The return value of the searchHistory function is an array of strings containing the last 10 queries the user searched for. The first item in the array is the most recent search.

[
    "pants",
    "shirt",
    "ties",
    "shoes for men",
    "shoes",
    "hat",
    "pants",
    "jacket",
    "hoodie",
    "sweatshirt"
]

Example

In this example, we get the past 10 queries the user has made and then loop over them and console log each item.

// Get search history
const history = await getSearchHistory();

// Console log each past query
history.forEach(console.log);