Google Analytics API for tracking site searches?

So, this is a great _trackPageview () api method on the tracker object, but is there an appropriate method that can be used to manually track the search? In other words, _trackPageview() tells GA that the user has reached the page. I want something like _trackSearch("terms") that tells GA that the user was looking for something.

+6
search google-analytics
source share
2 answers

Although this is not quite what I was looking for, it seems that you can create virtual pageviews to track search results programmatically.

Suppose you set up a site search parameter called "q" so that when a URI that contains q=these+are+some+terms , GA will mark it as a search result. You can use the _trackPageview() method to create virtual search queries like this:

 pageTracker._trackPageview('/custom/search?q=These+are+some+terms') 
+2
source share

I pass the search parameters to GET, so the search URL in "TEST" is

 http://www.example.com/search?q=TEST 

Selecting ContentSite Search from my analytics account gives me a list of all keywords found.

Check out the documentation to learn more, especially How to set up a site for my profile? .

+1
source share

All Articles