Drupal Module Functionality

Tracking Search Results

The SearchStax Site Search solution supports tracking search results for a Drupal website.

Search results are automatically tracked for all searches known to the Drupal Search API module. No further configuration is needed. You can verify which searches are “known to the Drupal Search API module” by going to the SearchStax configuration page and seeing which searches are listed under Search-specific analytics keys.

In case you use custom code on your site to display a search page and your search is not listed there, you have to provide a Search API “Display” plugin for your search. See the Search API documentation for details. This will also allow other modules, like Facets and Search API Autocomplete, to work with your search, so is good practice in any case.

Tracking Search Results Clicks

As there are a lot of different ways how search results, and the associated result links, are generated in Drupal, the SearchStax module cannot reliably provide support for tracking search result clicks for all of them. A best effort is made to at least provide click tracking out-of-the-box for the most common setups for the two most popular ways of generating search pages, Views and Search API Pages.

Technical Information

For seeing whether your search is already supported, execute a search with keywords, then open your browser’s development tools pane (Network tab) and finally click on any search result. In the Network tab you should then see a request to a URL like https://app.searchstax.com/api/v2/track/?data=DATA, where DATA is a base 64-encoded JSON string with the tracking data. It should contain "event":"_searchclick".

Please contact us if you want to add click tracking for another search. In any case, you can use the _searchstax_add_tracking() helper function provided by the SearchStax Drupal module to implement this. You can also see examples for this in the searchstax.module file.

In combination with the Search API Autocomplete module, provide suggestions to visitors when they enter search keywords, backed by the Site Search suggestion engine.


Do not hesitate to contact the SearchStax Support Desk.