Using Google Analytics to track Funnelback search usage

This guide provides advice on how to configure Google Analytics to track usage of your Funnelback search.

Initial Google Analytics setup

This section outlines the basic steps to get user activity tracked in Google Analytics. This includes:

  • Setting up a new property to an existing Google Analytics account

  • Adding the tracking code to the search implementation

  • Reviewing the results

ga behaviour overview

Creating a new property

A dedicated Google Analytics property will be used to track search usage so that this can be separated in the analytics report.

ga admin properties
We will be using the default all web site data view for this guide.

If you wish to map the user journey in an existing website and see how search is affecting your predefined goals, please feel to use a previously defined property.

For more information about properties, views and the general hierarchy, please see the Google Analytics help.

Adding the tracking code

The tracking code is responsible for collecting user’s interactions and sending it to the Google Analytics servers.

The tracking code is a small Javascript block that must be included in your search results pages.

If you are using Funnelback Freemarker templates then you would typically add the Javascript to the template footer, in a similar place to where auto-completion is configured.

If you are consuming the search JSON output then you would add the Javascript to your code that renders the search results.

Reviewing the results

Once the Javascript tracking code is published, user activity should be tracked and logged in Google Analytics. To verify this:

  • Run some test searches on your site.

  • Verify that queries are being logged, open Google Analytics and view the real time or behavior reports.

ga realtime overview

Advanced setup

This section covers information on combining URLs, grouping content and enabling the site search reporting in Google Analytics. This enabled better highlighting of the performance of different sections of the search implementation and provides more information on what users are asking.

Excluding URL query parameters

Query parameters are used to control a lot of the behavior in Funnelback. For example, to sort the results by date, the user can append simply sort=date to the request URLs.

Unfortunately, this has the side effect of diluting the statistics being capture in Google Analytics and potentially cluttering the reports.

By default, Google Analytics separates URLs with different query parameters into different rows. This means it is difficult to get a picture of certain queries as the statistics are spread across two or more rows.

The following image demonstrates how query parameters can clutter the reports.

ga behaviour site content all pages query parameters

If metrics related to things like sorting or pagination are not required, they can be easily be ignored from Google Analytics by using the exclude URL query parameters option.


ga admin view query parameters

Sample values for the exclude URL query parameters option:


The above will ignore the profile, collection, sorting, contextual navigation and pagination parameters when generating entries as you don’t want variants of these to create separate entries in the analytics report.

Setting up content grouping

Content grouping provides the ability to group content into a logical structure which better represents the application. A common use case for this is to group queries by tabs.

Below is an image of an intranet search which separates content into tabs:

ga find squiz tabs

And this is what the corresponding content grouping might look like in Google Analytics for tabs:

ga content grouping tabs

By grouping content together, it provides a convenient mechanism to filter large pools of information as well as highlighting the popularity and effectiveness of various configurations.

Below is an example configuration of grouping by tabs:

ga content grouping config

For this particular example, we used the group using rule definitions option, supplying regular expressions to match against search URLs.

  • Articles: .*f.Tabs[^=]+=Articles.*

  • Posts : .*f.Tabs[^=]+=Posts.*

  • Contacts: .*f.Tabs[^=]+=Contacts.*

  • Social Media: .*f.Tabs[^=]+=Social\+Media.*

  • Experimental: .*f.Tabs[^=]+=Experimental.*

The above technique can also be extended to group by the results page that is being used for the search (by specifying a collection and profile pair). This is useful if you provide different searches on your site (e.g. global site search, publications search) and need to separate the analytics for these.

For more information please see the about content group section in the Google Analytics Help.

Google Analytics provides a dedicated section called site search which aims to provide insights on queries (also known as search terms in Google Analytics) entered by users.

ga behaviour site search search terms

Site search can be enabled by simply turning site search tracking to on and entering query in the query parameter field.

ga admin view site search tracking