I've been looking for a way to get Google Universal Analytics to keep track of our internal search results. We use the simple search and have results showing up in our search log inside EE.

There is a solution laid out in this article for the old analytics system: tracking site searches in google analytics

I'm wondering if anyone has done something similar for the new code Google has blessed us with.

Maybe something like:

ga('create', 'UA-XXXX-Y', 'auto');
ga('send', 'pageview {if segment_1 == 'search' && segment_2 == 'results'}, ['/search/results/?q={exp:search:keywords}']{/if}); 

Thank you in advance,


  • I need this too as the old method (expressionengine.stackexchange.com/questions/368/…) does not seem to work with new analytics script.
    – Boshy
    Oct 2, 2014 at 15:06
  • 1
    Boshy, after looking through a number of google's documentation pages, I found that it was necessary to create a separate page view for search pages. In doing so, you can add specific code to the value sent to google, including the search term. `ga('create', 'UA-16559561-1', 'auto'); ga('send', 'pageview', '/search/results/?q={exp:search:keywords}'); Oct 6, 2014 at 18:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.