track().search

The track().search() method tracks searches on your internal search engine.

Syntax

TrackHelper.track()
  .search("keyword")
  .category("category")
  .count(searchCount)
  .with(getTracker());
TrackHelper.track()
  .search("keyword")
  .category("category")
  .count(searchCount)
  .with(tracker)

Parameters

keyword (string, required)

The keyword the user typed into the search box.

category (string | array, optional)

The category selected in the search engine.

searchCount (number, optional)

The number of search results.

Examples

To send an internal search with the keyword “ATM in London” and 20 search results, but no category:

Tracker tracker = ((PiwikApplication) getApplication()).getTracker();
TrackHelper.track()
  .search("ATM in London")
  .category("")
  .count(20)
  .with(tracker);
val tracker: Tracker = (application as PiwikApplication).tracker
TrackHelper.track()
  .search("ATM in London")
  .category("")
  .count(20)
  .with(tracker)