Pre requisites: Raptor tracking script
The following examples assumes that you have already implemented the Raptor tracking script on your website. If not, please refer to the article here
search
event
When a user types in a search phrase in a text field, a search
event should be fired after a small delay, in order to track the entire search phrase. We recommend a delay of 500ms after typing in the search input field
raptor.push("trackevent",{p1:"search",p17:"SEARCH_PHRASE_HERE"});
NB: The parameter numbers (p1,p2...) can differ, depending on your implementation.
Please refer to your implementation page in the controlpanel, in order to get the exact parameters to send in this event
Example of javascript implementation
This is a code snippet that illustrates, how you could implement the tracking on a search input field, in order to wait for the entire search phrase
searchclick
event
When a user clicks a search result, a searchclick
event should be sent to Raptor.
Notice that the parameter with the position of the clicked element in the search result is optional.
raptor.push("trackEvent",{p1:"searchclick", p2:"{PRODUCT_ID_HERE}", pX:{OPTIONAL_POSITION_HERE}});
NB: The parameter numbers (p1,p2...) can differ, depending on your implementation.
Please refer to your implementation page in the controlpanel, in order to get the exact parameters to send in this event
Optional: searchresult
event
You have the option to send a searchresult
event, when the search result has been displayed on the website. We recommend picking up the "hits" array from typesense, and grapping the result from here. We don't need the entire result with all its data, just the productIds.
raptor.push("trackevent",{p1:"searchresult", pX:"{listOfProductIds}"});