> ## Documentation Index
> Fetch the complete documentation index at: https://docs.helloleo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Marketing Automation with Klaviyo

> Build marketing automation workflows using Klaviyo

Learn how to build a marketing automation dashboard that connects to your Klaviyo account, managing email campaigns, customer segments, and marketing workflows.

## Overview

This example demonstrates building a marketing automation platform that:

* Manages Klaviyo email lists and segments
* Creates and sends email campaigns
* Tracks campaign performance
* Manages customer profiles and preferences

## Prerequisites

* Klaviyo integration configured in HelloLeo
* Klaviyo account with Private API Key
* Basic understanding of email marketing concepts

## Step-by-Step Guide

### 1. Set Up the Integration

First, ensure your Klaviyo integration is configured:

1. Go to **Project Settings** → **Project Integrations**
2. Select **Klaviyo** and enter your Private API Key
3. Test the connection

### 2. Create the Dashboard Overview

Start by creating a dashboard showing marketing metrics:

```
Create a marketing dashboard that displays:
- Total subscribers count
- Active email lists count
- Recent campaigns
- Campaign performance metrics (open rate, click rate)
- Revenue from email campaigns

Fetch data from Klaviyo to calculate these metrics.
```

### 3. Display Email Lists

Create a page to manage email lists:

```
Create an email lists page that shows all lists from Klaviyo.
Display:
- List name
- Subscriber count
- Created date
- Growth rate
- Actions (view, edit, delete)

Fetch lists from Klaviyo API and display in a table.
Add search to find lists by name.
```

### 4. Manage Customer Profiles

Create a customer profiles page:

```
Create a customer profiles page showing all profiles from Klaviyo.
Display:
- Email address
- First name, last name
- Subscription status
- Tags and segments
- Last activity date
- Actions (edit, unsubscribe, add to list)

Fetch profiles from Klaviyo with pagination.
Add filters for subscription status and tags.
```

### 5. Create Email Campaign

Build a campaign creation form:

```
Create an email campaign creation form that:
- Allows selecting email list or segment
- Sets campaign name and subject
- Chooses email template
- Schedules send time
- Shows preview

Use Klaviyo API to create campaigns.
```

### 6. Track Campaign Performance

Create a campaign analytics page:

```
Create a campaign performance page showing:
- Campaign name and send date
- Recipients count
- Open rate percentage
- Click rate percentage
- Revenue generated
- Unsubscribe rate

Fetch campaign metrics from Klaviyo API.
Display data in charts and tables.
```

### 7. Manage Segments

Create segment management:

```
Create a segments page to manage customer segments:
- List all segments from Klaviyo
- Show segment criteria
- Display segment size
- Allow creating new segments
- Edit existing segments

Use Klaviyo API to manage segments.
```

## Example Prompts

### Initial Setup

```
Build a marketing automation dashboard with:
- Overview page with key metrics
- Email lists management page
- Customer profiles page
- Campaign creation form
- Campaign performance analytics
- Segments management

Connect all features to Klaviyo.
```

### Enhancements

```
Add A/B testing functionality to campaigns:
- Create variant campaigns
- Split audience
- Track performance of each variant
- Show winner
```

```
Create an automation workflow builder:
- Define triggers (customer signup, purchase, etc.)
- Set actions (send email, add to list, etc.)
- Create workflow visual diagram
- Activate/deactivate workflows
```

```
Add email template gallery:
- Show available Klaviyo templates
- Preview templates
- Select template for campaign
- Customize template content
```

## Key Klaviyo Concepts

* **Profiles** - Customer records in Klaviyo
* **Lists** - Static collections of profiles
* **Segments** - Dynamic groups based on criteria
* **Campaigns** - Email sends to lists or segments
* **Flows** - Automated email sequences
* **Metrics** - Performance data (opens, clicks, revenue)

## Best Practices

* **Segmentation**: Use segments for dynamic targeting
* **Personalization**: Leverage profile data for personalized content
* **Testing**: Always test campaigns before sending
* **Compliance**: Respect unsubscribe requests and email preferences
* **Performance**: Monitor campaign metrics and optimize based on data

## Campaign Types

* **Broadcast** - One-time sends to lists or segments
* **Flow** - Automated sequences triggered by events
* **A/B Test** - Testing different campaign variants

## Next Steps

* Add flow/automation builder for email sequences
* Implement event tracking (purchases, signups, etc.)
* Create custom email templates
* Add SMS campaign support
* Integrate with e-commerce platforms for purchase tracking

<CardGroup cols={2}>
  <Card title="Klaviyo Integration" icon="plug" href="/integrations/klaviyo">
    Learn more about Klaviyo integration
  </Card>

  <Card title="Working with Integrations" icon="book" href="/integrations/working-with-integrations">
    General guide for using integrations
  </Card>
</CardGroup>
