Tracking Swiftype search with Google Tag Manager

I have implemented Google Analytics through Google Tag Manager on a site running Swiftype. Google Analytics looks for the search query as a URL variable but Swiftype passes the search query as a URL fragment.

Does anyone know how to use Google Analytics search tracking reporting with Swiftype when implemented via Google Tag Manager?

I plan on doing just this very thing. And what I specifically need to do is track Search terms in Google Analytics when the single-page Swiftype app is running. GTM makes this easier to implement but also harder since you can only implement the solution within GTM.
My plan is to use the information on this post to turn #hash parameters into JS variables which GTM can pass to GA. Then to issue virtual page-views to GA via GTM for every search on the page.

So while search URLs will look like this:
The virtual page views sent back to Analytics via GTM will be something like this:
Search : UMass Amherst
Analytics is set to use the “q” parameter to designate search keywords and is also configured to ignore the parameter and thus not report the actual page-view a different URL per search term.
I have not done this yet, but I am reasonably sure that this will all work.

Tracking the search phrases from the URL variable only works if the visitor made it to the search results page. The majority of visitors click on a search suggestion from the search box which does not have a URL variable.

If SwifType would put a URL variables on the URLs in the search recommendations, this would work.

Unfortunately, for most sites the tracking method describe below would track less than half the searches.