Method Signature
Parameters
The search term that was submitted
Additional parameters for the tracking event
Optional parameters for the network request
Returns
Returnstrue on success or an Error object if validation fails.
Examples
Basic Example
Example with Group
Example with Analytics Tags
Integration Example
When to Use
CalltrackSearchSubmit() when:
- A user presses Enter in a search input field
- A user clicks a search submit button
- A search query is programmatically submitted
- A user modifies and resubmits a search
Important Notes
- The
termparameter should be the final submitted search term - The
originalQueryparameter should match what the user typed - If the term is autocorrected or modified,
originalQuerycaptures the user’s actual input - This event should be tracked before redirecting to search results
Relationship with Search Results
After trackingtrackSearchSubmit(), you should also track:
- trackSearchResultsLoaded - When results are displayed
- trackSearchResultClick - When user clicks a result
API Endpoint
This method sends aGET request to:
Related Methods
- trackInputFocus - Track search input focus
- trackAutocompleteSelect - Track autocomplete selections
- trackSearchResultsLoaded - Track search results display
- trackSearchResultClick - Track search result clicks