Examples
Klaviyo integration with SDK
3min
sending klevu events to klaviyo for klaviyo integration you need to build click event capturing and use klaviyo libraries to send the data to klaviyo this example shows how to create integration similar to what templatejs implements way the klaviyo klevu templatejs integration works is that when user has searched something and then clicks a product then searched term and clicked product is sent to klaviyo for this to work we need to extract little bit more information about the product and search metadata for it to be easier to create rules in klaviyo for this we have implemented annotationsbyid() function to result object here is generic pseudo code of how things should work in your code // first reference result object in your code somewhere in state or context let resultobject // function to enable analytics for klevu let clickevent // then call basic search in your input async function search() { const result = await klevufetch(search("hoodies", { id "search" })) resultobject = result queriesbyid("search") // its good idea to get klevu analytical events at the same time clickevent = result queriesbyid("search") getsearchclicksendevent() } // then in your click function async function productclick(klevuproduct) { //annotations take productid from results and language which to use get annotations in const annotations = await resultobject annotationsbyid(klevuproduct id, 'en') // here call the klaviyo api js with your custom event data // // remember to send clickevents to klevu too! clickevent(klevuproduct id) } now you can build a klaviyo analytics event with this annotations data example of event that is used in templatejs can be found in vanillajs example in here information on how to send event data to klaviyo can be found from klaviyo javascript api documentation using klaviyo for segmentation to enable the klaviyo integration for segmentation in klevu recommendations using the sdk, set enableklaviyoconnector to true in klevuconfig init klevuconfig init({ url "https //eucs23v2 ksearchnet com/cs/v2/search", apikey "klevu 160320037354512854", enableklaviyoconnector true, //to enable klaviyo integration for segmentation in recommendations }) setting enableklaviyoconnector to true will make all the necessary internal configuration changes for klevu recommendations to work with klaviyo segments you should consider using this feature with data protection settings if there is a need to meet any legal requirements if data protection is enabled, then no user data will be stored unless the consent is given check data protection docid 5egmkue do5kcdlaucerb for more information