sendSearch

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

Syntax

PiwikTracker.sharedInstance()?.sendSearch(
    keyword: "keyword",
    category: "category",
    numberOfHits: numberOfHits
)
[[PiwikTracker sharedInstance]
    sendSearchWithKeyword:@"keyword"
                 category:@"category"
             numberOfHits:@(numberOfHits)];

Parameters

  • keyword string, required - The keyword the user typed into the search box.
  • category string, optional - The category selected in the search engine.
  • numberOfHits NSNumber, optional - The number of search results. The SDK sends the count only for zero or positive values; it omits it when the argument is missing or negative.

Examples

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

PiwikTracker.sharedInstance()?.sendSearch(
    keyword: "ATM in London",
    category: nil,
    numberOfHits: 20
)
[[PiwikTracker sharedInstance]
    sendSearchWithKeyword:@"ATM in London"
                 category:nil
             numberOfHits:@20];