- Show a VIP message to customers in a
VIP memberssegment - Show a product recommendation when a Klaviyo profile property has a certain value
- Hide or show a portal action based on campaign, loyalty, churn-risk, or lifecycle data
- Pair a personalized Customer Portal message with a Klaviyo metric that tracks when a customer acts on it
Before you start
You need:- Customer Portal v2 enabled for your project
- The Klaviyo app enabled in Firmhouse
- A Klaviyo public API key for existing Klaviyo metric events
- A Klaviyo private API key for reading profile properties and segment membership
- Access to Customer Portal > Templates so you can edit Liquid templates
Create a private API key in Klaviyo
You must have an Owner, Admin, or Manager role in Klaviyo to manage API keys.- In Klaviyo, open Settings > API keys.
- Under Private API Keys, click Create Private API Key.
- Give the key a recognizable name, such as
Firmhouse Customer Portal. - Select Custom Key.
- Give the key these read permissions:
profiles:readsegments:read
- Create the key and copy it immediately. Klaviyo only shows a private API key once.
profiles:read and segments:read.
Read Klaviyo’s Authenticate API requests guide for the latest details about private API keys and scopes.
Set up Klaviyo profile access
- In Firmhouse, open Apps > Klaviyo.
- Enable the Klaviyo app if it is not enabled yet.
- Enter your Public API Key.
- Enter your Private API Key.
- Save the settings.
- The public API key is used for Klaviyo metric tracking and client-side Klaviyo usage.
- The private API key is used by Firmhouse to read Klaviyo profiles and segments on the server.
Use the Klaviyo profile Liquid object
Klaviyo data is available through the current subscription:klaviyo_profile object exposes:
Firmhouse looks up the Klaviyo profile by the subscription email address. If no private API key is configured, if the subscription has no email address, or if Klaviyo does not return a profile, the object renders as empty data.
Show content based on a profile property
Usesubscription.klaviyo_profile.properties when the decision is based on a custom property on the Klaviyo profile.
customer_tier. For keys with spaces or special characters, use bracket notation or normalize the property name in Klaviyo first.
Show content based on segment membership
Usesegment_names when you want to check whether a customer is in a named Klaviyo segment.
segment_ids instead of segment_names when you want the template logic to keep working if a segment is renamed in Klaviyo.
Combine Klaviyo data with Customer Portal actions
You can combine Klaviyo conditions with Customer Portal components. For example, show an add-product action only for customers in a specific segment:Track Customer Portal actions in Klaviyo
Use Klaviyo’s public Client Event API when you want to track that a Customer Portal message was shown or clicked. This is a browser-side API, so use your Klaviyo public API key, also called the Site ID. Never expose your Klaviyo private API key in Customer Portal HTML or JavaScript. A practical pattern is to define one helper function in theshared_head template, and then call that helper from any page, dialog, or button where you want to track a Customer Portal action.