Klaviyo : Segmentation
The following guide will walk you through accessing Klevu Smart Recommendation configurations and applying corresponding pre-configured segments to web visitors via the Klevu API.
To implement Klaviyo segmentation logic with Klevu Smart Recommendations, you need an active subscription to Klaviyo and Klevu Smart Recommendations (with Personalization enabled).
The intitial setup and configuration process takes place within the Klevu Merchant Center. Detailed instructions on how to integrate Klaviyo with Klevu Smart Recommendations can be found here.
There are four key steps to consider: 1. Fetch the applicable segments for the visitor 2. Apply the Segments to the Recommendations configuration 3. Request and display the Klevu Recommendations banner 4. Collect Klevu Analytics (impressions and interaction)
Three parameters are necessary to obtain the appropriate visitor segments 1. Klevu API KEY 2. Klevu Session ID 3. Klaviyo Exchange ID
Once the Klevu Session ID and the Klaviyo Exchange ID have been obtained, they can be stored locally and used in subsequent calls to Klevu for recommendations.
Retain the sessionId value for this user for use in subsequent API calls to Klevu for a maximum of the ttl time. At this point refresh the sessionId so as to retain continuity.
Klaviyo holds identity and tracking information in a local browser cookie. The exchange_id is an encrypted identifier for a Klaviyo profile ID. The value is commonly stored within the base64 encoded Klaviyo cookie “__kla_id” More information can be found on the Klaviyo developer's website:
Retain the $exchange_id value for this user for use in subsequent API calls to Klevu.
Use the session endpoint to push the Klaviyo exchangeID to Klevu. This will allow Klevu to communicate with Klaviyo directly and return the visitor's applied segmentation.
Retain the segment value for this user for use in subsequent API calls to Klevu.
IMPORTANT: The segments may be updated for any given visitor throughout the session. To keep the segments relevant, please request an updated segment list after the ttl has expired.
Please review the section on API Configurations for a complete list of applicable parameters to use based on the application/placement of the Recommendation banner.
Retain spotKey, spotName, segmentKey, segmentName for reference in the following Analytics collection API calls to Klevu.
The resulting search.payload JSON object will be the query payload used to call Klevu for the recommendations corresponding result set.
Use the provided query structure from the search.payload json within the above response to retrieve the Recommendations array from Klevu
See the Klevu Smart Recommendations API Overview for details on query specifics.
After the Recommendations have been displayed, collect the analytics to send to Klevu.
Please use the appropriate event value for each event type
- Product recommendation impression: event = view_recs_list
- Product clicks from recommendation banner: event = select_recs_list