How to configure and activate internal search tracking on your online store with Google Analytics
How to enable internal search engine tracking in Google Analytics
Then click on “Admin” (1).
Then on Display Settings (2).
2. Enable internal search engine tracking
Scroll down to Site Search Settings and then enable the Site Search Tracking slider (3).
After enabling this, you will see a field to enter a query parameter (4), the query parameter being the letter that appears in your online store URL before the search terms. It will be used to track and retrieve the queries.
You can find on your site when you do a search (here the letter is D):
Be sure to check the Remove query parameters from URL box so that Google Analytics can split the tracking for each page.