Shopify Klaviyo Integration: Beyond the Basics
The default Shopify-Klaviyo integration handles the basics, but the real revenue lives in custom event tracking, product-aware flows, and API-driven data sync. Here's how to build a Klaviyo integration that actually moves the needle.
Klaviyo's native Shopify integration is solid for getting started. Install the app, connect your store, and you get basic event tracking — Placed Order, Started Checkout, Viewed Product. You can build abandoned cart flows and post-purchase emails within an hour. But if that's all you're doing with Klaviyo, you're leaving serious money on the table.
I've been building custom Klaviyo integrations for my own multi-location retail business and for clients for several years now. The difference between a store running the default integration and one with custom event tracking, product-aware flows, and API-driven data sync is typically a 3–5x increase in email-attributed revenue. Here's what "beyond the basics" actually looks like.
Why the default integration isn't enough
The native Shopify-Klaviyo integration tracks a fixed set of events. It knows when someone views a product, adds to cart, starts checkout, and places an order. That covers the standard e-commerce funnel, but it misses everything that makes your business unique.
It doesn't know that a customer bought a road bike and should be getting accessory recommendations two weeks later. It doesn't know that someone browsed three different helmet models in the same session, suggesting they're comparison shopping. It doesn't know that a customer's last tire purchase was 8 months ago and they're probably due for replacements. All of that context — the stuff that turns generic emails into revenue-generating personalization — requires custom work.
Custom event tracking
The first step beyond the default integration is tracking events that matter to your business. Klaviyo's API makes this straightforward — you send custom events with whatever properties you want, and they become available for flow triggers and segmentation.
Here's an example: tracking when a customer views a specific product category multiple times, which signals high purchase intent.
// Track category browsing behavior
const trackCategoryIntent = async (
email: string,
category: string,
viewCount: number,
products: string[]
) => {
await fetch('https://a.klaviyo.com/api/events', {
method: 'POST',
headers: {
'Authorization': `Klaviyo-API-Key ${KLAVIYO_API_KEY}`,
'Content-Type': 'application/json',
'revision': '2024-10-15'
},
body: JSON.stringify({
data: {
type: 'event',
attributes: {
metric: { data: { type: 'metric', attributes: { name: 'Category Intent Signal' } } },
profile: { data: { type: 'profile', attributes: { email } } },
properties: {
category,
view_count: viewCount,
products_viewed: products,
intent_level: viewCount >= 3 ? 'high' : 'medium'
}
}
}
})
});
};
Other custom events I track regularly: Wishlist Added (for price-drop notifications), Size Selected (to personalize future recommendations by fit), Store Location Visited (for local inventory emails), and Service Booked (for follow-up care instructions).
Product-aware flows that drive revenue
This is where custom Klaviyo work pays for itself many times over. A product-aware flow doesn't just know that a customer bought something — it knows exactly what they bought and uses that to drive relevant follow-up.
Cross-sell by compatibility. When a customer buys a high-end road bike, I trigger a flow that recommends compatible accessories: pedals that match their drivetrain, a saddle that fits the seatpost diameter, a computer mount designed for that handlebar shape. This isn't generic "you might also like" — it's specific, useful, and converts at 4–6x the rate of generic recommendation emails.
The key is maintaining a compatibility matrix in your product data. I store cross-sell relationships in Shopify metafields and sync them to Klaviyo as event properties when an order is placed. The flow then references those properties to populate dynamic product blocks.
Replenishment reminders. Consumable products have predictable replacement cycles. Tires last about 2,000–3,000 miles, brake pads 1,000–2,000 miles, chain lube gets used up monthly. I calculate expected replacement dates based on the product type and trigger reminder flows accordingly. A customer who bought tires 6 months ago gets a "time for new tires?" email with a direct link to compatible replacements for their specific wheel size.
Post-purchase education. For technical products, a post-purchase education sequence builds loyalty and reduces returns. Someone who just bought a new groupset gets a 3-email series: installation tips, break-in procedure, and maintenance schedule. This positions you as an expert, not just a retailer.
Advanced segmentation by purchase behavior
Klaviyo's segment builder is powerful, but the segments that actually move revenue require custom properties synced via the API. Here are the segments I build for every client:
Product category affinity. Not just "has purchased" but "primarily purchases from category X." A customer who has bought 5 apparel items and 1 component is an apparel customer — send them the new arrivals lookbook, not the drivetrain upgrade guide.
Price tier segmentation. Customers who consistently buy premium products respond differently than bargain hunters. I calculate average order value and maximum single-item price as profile properties and use them to control which products appear in recommendation emails.
Purchase velocity. How often does this customer buy? Monthly buyers should get frequent new-arrival emails. Twice-a-year buyers should get fewer, higher-impact communications. Over-emailing infrequent buyers is the fastest way to get unsubscribes.
Lapsed customer tiers. Instead of a single "winback" flow, I create tiers: 60-day lapsed (light nudge), 120-day lapsed (stronger offer), 180-day lapsed (last chance). Each tier gets different messaging and incentive levels.
Back-in-stock automation
Klaviyo has a built-in back-in-stock flow, but it's limited. It triggers on inventory changes for products a customer has explicitly signed up to be notified about. That misses a huge opportunity: customers who viewed an out-of-stock product but didn't sign up for notifications.
My custom implementation tracks Viewed Product events where inventory is zero. When that product's inventory goes positive (detected via a Shopify inventory webhook), I trigger a custom "Back in Stock" event for every profile that viewed it while it was unavailable. The email says "That [product name] you were looking at is back" — it feels personal because it is.
This consistently outperforms the standard back-in-stock flow by 2–3x in conversion rate, because the audience is larger (everyone who viewed, not just those who clicked the notify button) and the timing is precise.
Using the Klaviyo API for custom data sync
The real power of Klaviyo is as a customer data platform, not just an email sender. I sync data from multiple sources into Klaviyo profiles, creating a rich customer record that drives every flow and segment.
// Sync enriched customer data to Klaviyo profile
const syncCustomerProfile = async (customer: CustomerData) => {
await fetch('https://a.klaviyo.com/api/profiles', {
method: 'POST',
headers: {
'Authorization': `Klaviyo-API-Key ${KLAVIYO_API_KEY}`,
'Content-Type': 'application/json',
'revision': '2024-10-15'
},
body: JSON.stringify({
data: {
type: 'profile',
attributes: {
email: customer.email,
properties: {
lifetime_order_count: customer.orderCount,
lifetime_revenue: customer.totalSpent,
avg_order_value: customer.avgOrderValue,
primary_category: customer.topCategory,
preferred_store_location: customer.nearestStore,
last_service_date: customer.lastServiceDate,
customer_tier: customer.loyaltyTier,
days_since_last_purchase: customer.daysSinceLastOrder
}
}
}
})
});
};
I run this sync on a schedule — daily for active customers, weekly for the full database. The profile properties then power dynamic content in every email: showing the customer's nearest store location, recommending products in their preferred category, and adjusting messaging based on their loyalty tier.
Real revenue impact
For my own business, custom Klaviyo flows account for roughly 28% of total email revenue, up from about 10% with just the default integration. The biggest individual performers are the cross-sell compatibility flows (they convert because they're genuinely useful) and the replenishment reminders (they convert because the timing is right).
The investment is primarily in the initial setup — building the data sync, creating the event tracking, and designing the flow logic. Once the infrastructure is in place, new flows are quick to build because the data is already there. A new product-aware flow goes from concept to live in a day, not a week.
If you're a Shopify store using Klaviyo and your email strategy is limited to abandoned cart and post-purchase thank-you emails, you're barely scratching the surface. The platform can do so much more — it just needs the right data and the right developer to wire it up.
Need help with your Shopify store?
I build custom Shopify solutions, AI automations, and integrations that save real time and drive revenue. Let's talk about your project.
Get in touch