Track search keyword with ajax form submit

I’ve a form with an input text.
When i submit it, an ajax request is sent to proceed the search.

How can i track the keyword from the input text ?

With this code, no need to use Tag Manager

$('#submit-search-form').click(function () {
    let keywords = document.getElementById('keywords').value,
        matomoTracker = Matomo.getTracker(URL_MATOMO + 'matomo.php', ID_SITE_MATOMO);
    matomoTracker.trackSiteSearch(keywords, "Words", true, false);