Tracking ajax-based search with Google Analytics

google-analytics, jquery

Solution

Lodge a virtual pageview (a trackPageview-call with a second parameter) in your ajax request with your search parameter as a get parameter in the virtual url (the name for the search parameter must be configured in the GA backend).

...(on ajax success)..:
_gaq.push(['_trackPageview','mysite/?q=searchterm']);

Problem

We have a search box that displays results on Google Map embedded into the page. We use ajax async calls to the server to perform the search and then display the results back on the map without any redirect or change in the page url. Is it possible to use Google Analytics' Site Search to track this? What would be the set up for that? Or is this not something that was meant to be tracked with Site Search feature at all?

Original source