Google Analytics Integration

Managed by | Updated .


This guide outlines the steps required to include search usage into an existing Google Analytics accounts.

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

Creating a new property

At Funnelback, we treat search implementations as its own first class application. To represent this, we create a dedicated property to isolate all the analytics from other applications.

Note: We will be using the default "All Web Site Data" view for this guide.

Alternatively, 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 heirarchy, please see Google Analytics help center

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 can be viewed by navigating to:

Property -> Tracking Info -> Tracking Code

Once the tracking code has been located, it can then be included in the Funnelback search templates (e.g. simple.ftl)

Reviewing the results

If all goes well, user activity should now be tracked and logged in Google Analytics. To verify this, please see the following steps:

  • Navigate to the search engine result page (SERP) and enter a few sample queries to simulate user activity.
  • To verify that queries are being logged, open Google Analytics and view the "Real Time" or "Behaviour" reports.

Advanced setup

So far, we have described how to enabled basic user tracking in Google Analytics. In this section, we will be taking this a step further by combining URLs, grouping content and enabling the Site Search reporting in Google Analytics. This will better highlight the performance of different sections of the search implementation and provide more information on what users are asking.

Excluding URL query parameters

Query parameters are used to control a lot of the behaviour 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 effects 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.

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 Parameter


Sample values for Exclude URL Query Parameter:


The above will ignore profile configurations, collections, sorting, contextual navigation and pagination.

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:

And this is what the corresponding content grouping might look like in Google Analytics for 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:

For this particular example, we used GROUP USING RULE DEFINITIONS using regular expressions to match against pages.

  • 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 collections and profiles.

For more information please see the About Content Group section in Google Analytics Help.

Optimising for Site Search

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.

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

Going forward

Google Analytics is a powerful platform which can provide invaluable insights about your users. It allows you to not only track you user's behaviour, but also let's you to slice and dice you data into different segments and content groups to better understand how people are using your site. More importantly, it lets you identify key factors which are contributing to user frustrations. This will hopefully lead to a better user experience and higher user satisfaction.

For more information about using Google Analytics, please refer to Google Analytics Help.

Was this artcle helpful?

Type: Keywords: