I have a page on my site that allows users to query for data in a database. Searching is all done via Ajax. We would like to begin tracking user behavior on this page with Google Analytics and I'm trying to confirm it is being approached in the correct way.

We can not use the built-in GA search tracking because our site's queries are performed with Ajax and doesn't use url params (all POST).

We had planned on using Events tracking for this, grouping the entire page by Category and the different actions (filter, sort, etc) by action. Triggering a GA Event for each individual part of the query.

Use Case #1 User queries for all records in USA.

ga('send', 'event', 'Search', 'Filter_Country', 'USA');

Use Case #2 User queries for all records with the color blue.

ga('send', 'event', 'Search', 'Filter_Color', 'Blue');

Use Case #3 User queries for all records in USA with the color blue.

ga('send', 'event', 'Search', 'Filter_Country', 'USA');
ga('send', 'event', 'Search', 'Filter_Color', 'Blue');

Ok, I know that all looks pretty basic, but think about what happens when there are 30 different countries and colors.

My question really comes down to the idea of triggering each filter independent of each other (still in the same session). Will this still allow us to pull reporting on them tied together - e.g. will we be able to query GA to show us stats for what are the top colors searched for grouped by country?

Or in order to do this do we need to trigger a single event for the entire query? E.g.:

ga('send', 'event', 'Search', 'Query', 'USA+Blue');

1 Answer 1


The report to look at will be in Behavior -> Events -> Top Events.

I would suggest using ga('send', 'event', 'Search', 'USA', 'Blue');

Then the first page of the report will only list the category ("Search"):

When you click on "Search" you will then see the countries:

Then when you click on a country you will see the searches for that country:

However, you would not be able to reverse the report and see for each color, the top countries.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.