This documentation is currently under development. Certain sections are not yet complete and will be added shortly.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Extensibility

Advanced setup patterns like multi-list routing and safe rollout guidance.

Extensibility is used when the default Klaviyo connector behavior does not match the Brand’s data model.

The most common extension is multi-list subscription routing.

Real-world examples
  • A Brand routes consents_email to a “Newsletter” list and consents_sms to a “VIP SMS” list.

  • A partner needs custom list routing based on store, language, or program.

Custom mapping

/**
 * Maps The Wallet crew account data to Klaviyo format.
 *
 * @param {Object} account - Data coming from The Wallet Crew
 * @param {Object} data - Data sent to Klaviyo. Standard mapping is already applied on this object.
 */
function mapToKlaviyo(account, data){
  const phoneNumber = account["phoneNumber"]
  if(phoneNumber){
    data.phone_number = phoneNumber; 
  }
}

export default function(context) {
  context.register('extensions.klaviyo.mapper', {
    MapToKlaviyo: mapToKlaviyo
  });
}

Multiple list subscriptions via /server/script/klaviyo.js

This pattern replaces the single listId configuration.

Implementation details and code example: Multiple lists (advanced).

Rollout and safety guidance

A conservative rollout reduces surprises in segmentation and consent.

  • Start in staging.

  • Validate on a small set of test profiles.

  • Monitor events and profile properties in Klaviyo.

  • Roll back by removing the script entry point, then re-test.

FAQ

Does a script change affect existing profiles?

Yes. Once deployed, scripts can change how subscription updates are computed for any profile that goes through an enrolment flow.

Validation in staging is recommended.

Last updated