# Klaviyo List & Segment Targeting

Canonical URL: https://support.optimonk.com/en/articles/klaviyo-list-segment-targeting

Klaviyo's advanced segmentation helps you create highly personalized flows with a relevant offer for each segment. If your store is integrated with Klaviyo, OptiMonk can show — or hide — a campaign for any of your existing Klaviyo lists and segments.

The rule is called **Klaviyo lists and segments** — *Klaviyo list / segment membership* — and it gives you two choices:

- **Don't display to existing Klaviyo profiles** — the campaign only appears to visitors Klaviyo doesn't know yet.
- **Target visitors in a list or segment** — the campaign appears to (or is hidden from) the members of the lists and segments you pick.

---

## Before you start

💡 To use this targeting condition, a Klaviyo integration must be set up on your OptiMonk account. If you are not familiar with how OptiMonk's Klaviyo integration works, you can find more information here. You can also connect Klaviyo without leaving the rule — see *Connect Klaviyo from the rule* below.

💡 To use Klaviyo's List & Segment Targeting, you need to have Klaviyo's onsite tracking code on your website. If you are using a **Shopify**, **WooCommerce**, or **Magento** store, this code is added automatically when you set up the Klaviyo integration for your site.

If you use **BigCommerce** or **Wix**, you will have the option to add this code when you are setting up the Klaviyo integration by checking the setting **Automatically add Klaviyo onsite JavaScript** in Klaviyo. If you are using a different store, you can also add the required tracking code **manually**. For more information, please check Klaviyo's guide: [Getting started with Klaviyo onsite tracking](https://help.klaviyo.com/hc/en-us/articles/115005076767-Guide-to-Klaviyo-Onsite-Tracking)

**❗ Anonymous visitors.** The rule relies on Klaviyo's cookies, and the editor says so in the *How it works* box: *The system considers every visitor a new anonymous visitor if they have recently cleared their cookies, are using a new device to browse, or visit your site using an incognito/private browser window.* Membership is checked against Klaviyo when the visitor is identified, so anonymous visitors never match a membership rule.

**Where the rule appears.** OptiMonk offers this rule only when Klaviyo is detected on one of your domains, or a Klaviyo integration is already connected. If neither is true, the rule is not in the list — set the integration up first. Inside the rule you may also see: *No connected Klaviyo integration on this account. Connect Klaviyo first (Integrations), then add this rule.*

---

## Target a campaign at a Klaviyo list or segment

1. Open **Campaigns** in the left menu and click the campaign you want to target.
2. Open the **Settings** tab of the campaign.
3. Scroll to **Who should see the popup** and click **Add new rule**.
4. Pick **Klaviyo lists and segments** from the list.
5. If you have several Klaviyo accounts connected (for example one per store), pick the one this campaign should use in the **Klaviyo integration** dropdown. With a single connected account the dropdown is not shown — that account is used.

⚠️ The rule is bound to the integration you pick here. Switching to another integration clears the lists you already selected, because lists belong to one Klaviyo account.
6. Choose one of the two conditions:

- **Don't display to existing Klaviyo profiles** — *The campaign will only appear to visitors who are unknown to Klaviyo.*
- **Target visitors in a list or segment** — then pick the groups in the two boxes below.
7. With **Target visitors in a list or segment** selected you get two lists to fill:

| Box | What it does |
| --- | --- |
| Display to visitors in any of the following lists or segments | The campaign will appear to cookied visitors who are members of any of the lists or segments you select. |
| Don't display to visitors in any of the following lists or segments | The campaign will only appear to visitors who are not known to be members of any of the lists or segments you select, including both anonymous visitors and visitors who are cookied, but not known to be a member of any of the selected groups. |

Use **Add list or segment...** to add a group; each entry shows whether it is a *list* or a *segment*. A group you already used in one box is no longer offered in the other. Remove a group by clicking the × on it.
8. Click **Save** in the rule window, then **Save changes** in the bar at the bottom of the Settings tab.

On a campaign that is already published, the saved rule is pushed to the live campaign, so you don't have to publish again.

💡 You can also ask the assistant on the right to set the rule up for you.

### What the rule card says afterwards

The card on the Settings tab sums the rule up in one line: **Not an existing Klaviyo profile**, **Member of …**, **NOT member of …**, or *No segments selected yet* if you left the lists empty.

---

## Connect Klaviyo from the rule

If the account you picked has no public API key yet — or you have no Klaviyo integration at all — the rule shows the key fields right there:

- **Klaviyo public API key** (*Add public API key*) — this is the site key Klaviyo's onsite tracking uses.
- **Klaviyo private API key** (*Add private API key*) — asked for only when you are connecting a brand new Klaviyo account here.
- **Connect** — saves the keys. Klaviyo checks them, so a wrong key comes back as *The API key is invalid, please try a different key.*

The link **Here you can find your API keys** takes you to the page in Klaviyo where you can copy them. Until a public key is stored, both conditions stay greyed out with the note *Add the public API key to target lists and segments.*

---

## If something is missing

The editor refuses to save an unfinished rule and tells you what to fix:

- *Connect and select a Klaviyo integration first.*
- *Pick at least one Klaviyo segment or list.*

---

## Things to keep in mind

- Targeting rules are combined with **AND**: a campaign with a Klaviyo rule and, say, a Country rule appears only to visitors who match both.
- Each rule type can be added once. An existing Klaviyo rule is greyed out in the picker with an **Added** tag — open the card itself to change it.
- This rule decides **who sees** the campaign. Sending new signups to a Klaviyo list is a different setting, on the campaign's **Integrations** tab — see Integrating OptiMonk campaigns with Klaviyo.
