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.

JS


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.

JS


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 for more information.