--- title: "Search History" slug: "search-history" updated: 2024-07-26T14:39:28Z published: 2024-07-26T14:39:28Z canonical: "docs.xgen.ai/search-history" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xgen.ai/llms.txt > Use this file to discover all available pages before exploring further. # Search History This function is used to get the past 10 queries that the user has made. ```javascript // 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. ```javascript [    "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. ```javascript // Get search history const history = await getSearchHistory(); // Console log each past query history.forEach(console.log); ```