sendSearch

The sendSearch() method tracks searches perfomrmed using your app's internal search feature.

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 the count 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];

Did this page help you?