Personalization in Emails

Personalization shouldn't stop at your webshop. By extending Tweakwise personalization logic to your email campaigns, you can significantly increase click-through rates and relevance.

This article explains how to retrieve user-specific product data, such as recently viewed items or algorithmic recommendations, to populate dynamic content blocks in your Email Service Provider (ESP).

We will cover two specific methods:

  1. Personal Feed: Retrieving a user's interaction history (e.g., "Pick up where you left off").
  2. Personalized Recommendations: Serving rule-based recommendations tailored to the user's profile (e.g., "Recommended for you").

Prerequisites

To serve personalized content, you must identify the user.

  1. The Profile Key: Ensure your frontend captures the Tweakwise profilekey (from the cookie or local storage).
  2. Syncing: Sync this profilekey to your ESP (e.g., Klaviyo, Spotler, Deployteq) as a custom field on the subscriber profile.
  3. Execution: Your ESP or middleware must be capable of making HTTP requests to the Tweakwise API at send-time or render-time.

Implementation

Method 1: The Personal Feed

This method returns the latest products a user has interacted with (viewed, clicked, or bought). It is ideal for abandoned browse emails or "Recently Viewed" sections in newsletters.

Endpoint: GET /feed

Request:
Pass the profilekey parameter to fetch the specific history for that user.

GET /feed/{instancekey}/{profilekey}

Response:
The API returns a list of product objects sorted by the most recent interaction.

[
  {
    "id": "12345",
    "name": "Wireless Headphones",
    "price": 199.99,
    "url": "[https://shop.com/audio/headphones](https://shop.com/audio/headphones)",
    "image": "[https://shop.com/img/12345.jpg](https://shop.com/img/12345.jpg)"
  },
  {
    "id": "67890",
    "name": "Bluetooth Adapter",
    "price": 29.99,
    ...
  }
]

Docs Reference: See the full Feed API documentation.


Method 2: Recommendations with Personalization

This method combines your merchandising rules with user behavior. It allows you to use specific recommendation algorithms (like "Others also bought") but re-ranks or filters them based on the user's affinity.

Endpoint: POST /recommendations/grouped (or your specific recommendation algorithm endpoint)

Request:
Include the profilekey in the body payload. This tells the algorithm to apply personal affinity weighting to the results.

POST /recommendations/grouped/{instancekey}/{productNo}/{groupKey}?tn_profilekey={profilekey}
Content-Type: application/json

Response:
Returns a set of products generated by your recommendation rules, depending on the builder configuration including personalized positions for the specific user.

Docs Reference: See the full Recommendations API documentation.


Notes & Important Considerations

  • Handling "Cold" Users: If a user has no history (no profilekey or a new key), the Personal Feed will return an empty array. Always build a fallback in your email template to show general top sellers or a curated list if the API returns no results.
  • Data Freshness: The profilekey links to real-time behavior. If a user browsed the site 5 minutes ago, the Personal Feed in an email sent now will reflect those views.
  • Authentication: Ensure your API requests from the ESP are using the correct instancekey. Since these are read-operations, standard authentication applies.
  • GDPR: The profilekey is a pseudonymized identifier. Ensure your privacy policy covers the use of browsing history for personalized marketing.