Got a site search engine on your website? Have you set up set up site search? If so, good on you! If not, go read Avinash Kaushik’s post on why you should be analyzing your site search and our post on how to use the site search report.

On most search forms, there’s only one keyword field and one category field. However, some search forms (like advanced search forms) have multiple keyword fields and categories the visitor can fill out. From the GA help, you would think this is easily accomplished by specifying the query parameters in a comma-delimited list. Here’s a quote of the relevant line:

Enter your ‘Query Parameter’ in the field provided. Please enter only the word or words that designate an internal query parameter such as “term,search,query”. Sometimes the word is just a letter, such as “s” or “q”. You may provide up to five parameters, separated by a comma.

From the last sentence, you would think that GA will read up to five parameters in the query string and report them together somehow (perhaps concatenated in the search terms report). However, this is not the case! In query strings where more than one search term query parameter exists, GA reports only the last search term parameter and discards the rest. Here’s some screen shots of my test profile configuration, the top content report, and the resulting search terms GA reports.

Site Search Setup

Top Content Report

Search Terms Report

The same problem occurs if more than one category parameter exists.

Site Search Category Report

How are the multiple search parameters and categories supposed to be used you ask? Well, it’s usually for the following two cases:

  1. Your site has multiple search forms, each one using different query parameters.
  2. You are tracking multiple sites in the same profile, and each site uses a different site search engine.

To achieve our goal of concatenating search terms, we need some custom JavaScript that reads the individual search parameters, and concatenates them into one parameter. Then, using virtual pageviews, we would pass the concatenated parameter to GA. Here’s some sample code that achieves exactly this.

<!–[CDATA[


]]>

The function concatTerms takes an array of search term query parameters, looks for those parameters within the query string, and returns a string with the search terms concatenated. We then create a virtual pageview using the concatTerms function to join the multiple search fields into one. Note that I've used the concatTerms function for both the search term fields (q1 and q2) and the category fields (c1 and c2).

Message Sent

Thank you for registering.

Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Thank you for submitting the form.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.

Message Sent

Thank you for registering.

Thank you for your submission.

Your request has been submitted and a rep will reach out to you shortly.

Message Sent

Thank you for your interest.

Thank you for registering.

You should receive a confirmation email from GoToWebinar with your unique webinar login information. If you do not receive this email or have trouble logging in to the event, please email asmaa.mourad@cardinalpath.com.

Thank you for subscribing!

You're now looped into the world's largest GMP resource hub!

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Success! Thank you
for reaching out.