How to save searches? Tracking Cookies?

Hello! I am currently building a site on WIX Studio. Currently, when someone filters products and clicks on a product, when they go back to the listings page, the search filters go away completely and they have to perform the search again. I was told that I have to install tracking cookies for this, but I am new to coding and have no idea where to start. I found some videos on YouTube, I went through each step, but it did not work. I would sincerely appreciate some help on this!
Thank you!

Namaste Brooks,

Hope you are well.

You can use the Wix Storage API to add this function on the product page. Here is a code that will add this function to the default product category page.

import { local } from 'wix-storage';

function saveFilter(filterName, filterValue) {
    local.setItem(filterName, filterValue);
}

function loadFilter(filterName, filterElementId) {
    const filterValue = local.getItem(filterName);
    if (filterValue) {
        $w(filterElementId).value = filterValue;
    }
}

function applyFilters() {
    const category = local.getItem('categoryFilter');
    const price = local.getItem('priceFilter');
    let filter = wixData.filter();
    if (category) {
        filter = filter.eq('category', category);
    }
    if (price) {
        filter = filter.lt('price', price);
    }
    $w('#productDataset').setFilter(filter);
}

$w('#categoryDropdown').onChange(() => {
    saveFilter('categoryFilter', $w('#categoryDropdown').value);
    applyFilters();
});

$w('#priceDropdown').onChange(() => {
    saveFilter('priceFilter', $w('#priceDropdown').value);
    applyFilters();
});

$w.onReady(() => {
    loadFilter('categoryFilter', '#categoryDropdown');
    loadFilter('priceFilter', '#priceDropdown');
    applyFilters();
});