Combing Tweakwise Recommendations with Klaviyo's Segments

Klaviyo CDP x Tweakwise

Directly fetching a list of article numbers from a CDP for recommendations can be counterproductive (if it's available), as it bypasses the Tweakwise rule engine.

To get the "best of both worlds," we recommend "weaponizing" CDP segments by turning them into Tweakwise rules.

The Strategy:

  • Configure in Tweakwise: Create a recommendation group with a specific key for each segment (e.g., GroupKey = "segment-vip").
  • Retrieve Segment: On the platform side, fetch the current user's segment from the CDP (using the Klaviyo Profiles API).
  • Request Recommendation: Call the Tweakwise Recommendations API using the retrieved segment name as the GroupKey.
  • Fallback: Always configure a generic recommendation (e.g., "Trending") if no segment is found for the user.

This method uses the CDP for audience intelligence while letting the Tweakwise rule engine handle product selection, stock logic, and sorting.

Retrieving Customer Segments
To find a customer's segments using their email address, follow these steps:

  • Step 1: Get Profile ID: Call GET /api/profiles/?filter=equals(email,"[[email protected]](mailto:[email protected])") to find the unique ID.
  • Step 2: Get Segments: Use the ID to call GET /api/profiles/\{profile_id\}/segments/.
  • Step 3: Process Data: Iterate through the response. Use attributes.name to identify active segments (e.g primary-segment) and use them in the next step.

Example
Imagine a fashion webshop, here is how we apply this when a user is viewing a coat product detail page:

  • Klaviyo identifies a customer as part of the "High-Spend Winter" segment because they buy expensive coats every year.
  • Your website/middleware retrieves the segment as High Spend Winter and maps this to the recommendation groupkey segment-winter-luxury.
  • The website/middleware calls Tweakwise using the groupKey:
    /recommendations/{instancekey}/{productid}/segment-winter-luxury
  • Tweakwise only shows products from the "Coats" category with a price > €200, applying the merchandising rules that are configured in Tweakwise.

Important Considerations

  • Scalability: This approach is manageable depending on the number of segments. You must create recommendation rules for each segment you wish to target.
  • Event-Based Architecture: Remember that Klaviyo is event-driven. You cannot "GET" a list of products from a profile; you must reconstruct that list from their timeline events.
  • API Versioning: Klaviyo requires a revision header (e.g., 2024-10-15). Using an outdated or missing revision date will cause your API calls to fail.
  • Rate Limiting: Ensure your middleware function handles Klaviyo’s API rate limits to avoid performance bottlenecks on your lister pages.
  • Middleware Performance: Ensure your middleware is optimized to prevent latency, as the External Data Component relies on these external calls.

Did this page help you?