search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection
Swiftype Documentation / tutorials: How to use Swiftype with Google Analytics

How to use Swiftype with Google Analytics

Google Analytics is a popular tool for tracking site-search analytics, and this tutorial will take you through the steps necessary to make sure searches through your Swiftype-powered search engine are tracked properly within your existing Google Analytics account.

Step 1: Make sure you're using the latest Google Analytics install code

Google Analytics has used a couple of different JavaScript-based install codes over the past few years.

You should make sure that you're using the latest "asynchronous loading" code, because it allows Swiftype to easily integrate with your analytics account. Also make sure that your Google Analytics install code is loaded before (above) your Swiftype install code on the page.

Beyond that, the asynchronous loading feature can improve the speed of your client-side page loads, so it generally provides an overall better experience for your users.

The latest version of the install code should look something like the following:


(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-XXXX-Y', 'auto');  // Replace with your property ID.
ga('send', 'pageview');

Note: Swiftype will also work with the original ga.js.

For more information on using the new Google Analytics tracking code, see Google's documentation here.

Step 2: Configure Site-search tracking for your Google Analytics account

Follow this sequence of steps to configure site-search tracking in your Analytics account. You can find additional details in Google's help center here (click on Setting Up Site Search for a View).

  1. Click the Admin tab at the top right of any screen in Analytics.
  2. If you are not already on the Account Administration screen, click the All Accounts link at top left, just below the orange bar.
  3. Click the account that contains the web property and profile for which you want to set up Site Search.
  4. Click the web property that contains the profile for which you want to set up Site Search.
  5. Use the View menu to select the view you want.
  6. Click the View Settings sub-tab.
  7. Under Site Search Settings, select Do Track Site Search.
  8. In the Query Parameter field:
    • If you use the Swiftype install code: enter stq
    • If you use the Swiftype WordPress plugin: enter s
  9. Click the 'Apply' button.

When you're finished, your profile settings screen should look something like the following. Keep in mind that Google Analytics site-search tracking can take up to 48 to start appearing in your dashboard.