You should already have Google Analytics installed on your website. If no - check out this article to learn how to create a Google Analytics account and add it to your WordPress site.
Then go to Admin, View and pick View settings.
Google Analytics View Settings
It eliminates the risk of crashing your resource because of incorrectly embedded into the website tags.
View Setting Query parameter
Below the toggle you will see the Google Analytics Query parameter field. You may have one or multiple query parameters on your site.
If there are several of them, then just list them and separate by comma.
For example: if,query,q,n
Note: query parameters may be represented in a form of a word, or a letter.
To understand what query parameter you should use for your site, go to your web resource and type in any search query.
It doesn't matter if your search result is completed with either of these results:
positive (yes, something has been found!),
or negative (nope, there is no result that meets your search criteria).
Then go to the browser address bar and look for either a word or a letter that stands after the question mark (?) and before the equal sign (=), and is followed by your keyword.
For example: www.test.con/?s=test
You can see that in the screenshot below that I performed a search on Coupler.io blog, and the Query parameter in this case equals the letter "s".
WordPress: identifying Query parameter example
Another example is from Facebook internal search. In the case of Facebook, their Query parameter is "q".
Facebook Query parameter
Now you go back to Google Analytics interface, enter "s" into the Query parameter field, and press Save.
Save Google Analytics View settings
Testing internal site tracking in Google Analytics for WordPress
To test whether the internal site tracking works for your WordPress resource, go back to your site and perform search. Wait for 3 to 6 minutes, then revert back to Google Analytics main screen. Then navigate to Behaviour, Site Search, Search Terms.
Google Analytics search results tracking
As always, I do hope you found this post useful! I would be happy if you decide to leave comments beneath this article! And talk to you soon!