Guide
Connectors
Klaviyo : Search Events
8 min
the following guide is for integrating klevu search events into klaviyos event tracking using api to implement the connector to klaviyo, you need an active subscription to klaviyo and be on a klevu plan with personalization enabled for details on the setup and configuration of klevu to klaviyo events within the platform(s), please see https //help klevu com/support/solutions/articles/5000878078 integration steps to send klevu search events to klaviyo you must have klaviyo active on the site to utilize klaviyo's api for pushing event data there are three key aspects to consider check the data against klevu nlp annotations api prepare the data object for push to klaviyo submit object to klaviyo as a klevu search event 1\ check the data against klevu nlp annotations api klevu provides an external function for klaviyo event tracking that will analyze and prepare the values to be sent to klaviyo although not required, this step is recommended to get the optimal values that will be injected into the klaviyo event flow this check may be fired after a search query and held in localstorage for use in constructing the object for the klaviyo event push (see step 2 below) name request the nlp annotations from klevu method get url https nlp services ksearchnet com klevu api key annotations description tab examples examples languages id sfntkfljkrby9f9o85oy language none code ?query search query n title product title n category product attribute category from search results n language store language iso code customlabel query parameters selectedlanguageid sfntkfljkrby9f9o85oy results languages id ulmfumedp1swyxjq6du0a language 200 customlabel code n apikey string n annotations n fullterm string n subjects str str n n responsemessage string n qtime long query time n id co n3v0qxsc5n8cforikw language 404 customlabel code n message ain t no cake like that n selectedlanguageid ulmfumedp1swyxjq6du0a request pathparameters queryparameters name query kind optional type string description the search query term as entered by the end user children name title kind optional type string description the name of the product that has been clicked or otherwise given context children name category kind optional type string description the category of the product that has been clicked or otherwise given context children name language kind optional type string description the store iso language code children headerparameters bodydataparameters formdataparameters currentnewparameter label query parameter value queryparameters example response { "apikey" "klevu 12345", "annotations" { "subjects" \[ "sneakers", "sneaker" ], "fullterm" \[ "men shoes" ] }, "responsemessage" "success", "qtime" 0 } 2\ prepare the data object for push to klaviyo the values returned by the klevu annotations query will be used in the object sent to klaviyo for use in the event flow product clicked tracking and search results data will need to be captured independently for use in the object build the object to push to klaviyo using the following json format { "search term" "string", // original search query "search term(full)" \["string"], //contained in the nlp response object "subjects" \["string","string"], //contained in the nlp response object "total number of product results" integer, // total number of products found by the search query "product clicked" { // product data for clicked product }, "search results" \[ { // product data for first product in the klevu search response }, { // product data for next product in the klevu search response }, // 10 products ], "recommended results" \[] // optional list of products formated similar to // the search results, only valid in the case of // click being extracted from a fallback query } example { "search term" "men shoes", "search term(full)" \["men shoes"], "subjects" \["sneakers","sneaker"], "total number of product results" 2, "product clicked" { "name" "acme men black sneakers", 	 "id" "456789", 	 "url" "https //myexample com/products/acme men black sneakers", 	 "imageurl" "https //myexample com/images/products/456789 images medium jpg?v=1666139322", 	 "price" "26 95", 	 "saleprice" "26 95" }, "search results" \[ { 	 "name" "cool men khaki shoes", 	 "id" "987654", 	 "url" "https //myexample com/products/cool men khaki shoes", 	 "imageurl" "https //myexample com/images/products/987654 images medium jpg", 	 "price" "29 95", 	 "saleprice" "29 95" 	 }, 	 { 	 "name" "acme men black sneakers", 	 "id" "456789", 	 "url" "https //myexample com/products/skechers men black sneakers", 	 "imageurl" "https //myexample com/images/products/456789 images medium jpg", 	 "price" "26 95", 	 "saleprice" "26 95" 	 } ], } 3\ submit object to klaviyo as a klevu search event learnq push(\["track", "klevu search", \<objecttopush>]); see klaviyo developer documentation for details on submitting tracked events https //developers klaviyo com/en/v1 2/docs/javascript api the event klevu search will now be available within the klaviyo profile > events view the event klevu search will now be available within the klaviyo profile > events view