trackSearch
The trackSearch() method tracks searches on your internal search engine.
Syntax
const options = {
category: `category`,
count: searchCount,
visitCustomVariables: { index: { name: 'name', value: 'value' },
customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackSearch('keyword', options);
Parameters
keyword (string, required)
The keyword the user typed into the search box.
options
Goal options: an object containing four properties.
category (string | array, optional)
The category selected in the search engine.
searchCount (number, optional)
The number of search results.
customDimensions
An object that specifies custom dimensions.
visitCustomVariables
An object that specifies visit custom variables.
Examples
To send an internal search with the keyword “ATM in London” and 20 search results, but no category:
const options = {
category: ``,
count: 20,
visitCustomVariables: { index: { name: 'name', value: 'value' },
customDimensions: { dimensionID: 'value', dimensionID: 'value', },
};
await PiwikProSdk.trackSearch('ATM in London', options);
Updated 6 days ago