The code would look something like this (you will have to modify this so it will work on your site):
var searchQuery = $('input[class="rsearch_sok2"]').val();
var p = document.location.pathname;
var s = "/?q=" + searchQuery + "&cat=no-results";
ga('send', 'pageview', {'page':p + s});
The code will:
- Take the query parameter from a input field
- Get the location path name (e.g /search/ from the url http://www.example.com/search/)
- Put the data from 1 & 2 into a string matching the search settings in Google Analytics.
- Send it into Universal Google Analytics