# Setup Guide

This guide will help you set up Klaviyo as a destination in the RudderStack dashboard. It also lists the configuration settings required to correctly send data from the supported sources to Klaviyo.

## Connection compatibility

{{< destination-config >}}

{{< info >}}
In the web device mode integration, that is, using [JavaScript SDK]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/_index.md" >}}) as a source, RudderStack loads the Klaviyo native SDK from `https://static.klaviyo.com/` domain. 

Based on your website's content security policy, you might need to [allowlist this domain]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/load-js-sdk.md#allowlist-destination-domain" >}}) to load the Klaviyo SDK successfully.
{{< /info >}}

## Setup

In your [RudderStack dashboard](https://app.rudderstack.com/), add a source. Then, from the list of destinations, select **Klaviyo**.

### Connection settings

| Setting | Description |
| :----| :-----|
| Name | Assign a name to uniquely identify the destination. |
| Public API Key | Enter the unique public API key from your [Klaviyo dashboard](https://www.klaviyo.com/login) (under **Settings** > **Account**). |
| Private API Key | Enter the private API key from your [Klaviyo dashboard](https://www.klaviyo.com/login) (under **Settings** > **Account**). This key lets you add users to a list or subscribe them using personalised emails/SMS. |
| API Version to use | Select the relevant API version from the dropdown: <br /><br/><ul><li>2024-10-15</li><li>2023-02-22 (**deprecated**)</li></ul> |

### Configuration settings

Configure the below settings to receive your data correctly in Klaviyo.

| Setting | Description |
| :----| :-----|
| List ID | Enter the default list ID to which you want to add or subscribe the identified users.  |
| Consent  | Select the consent type from **E-mail**, **SMS**, or both. `consent` is a Klaviyo-specific property that you need to include in your events if you run a GDPR-compliant business. <br /><br />**Note**: You can also override this setting by specifying the `consent` field in your event properties. |
| Enable this option to make email or phone as primary identifier |Turn on this setting to set a custom attribute `_id` and `$email` as the primary identifier when passed in `traits.email`/`properties.email`. RudderStack **does not** set `$id` field to the `userId` while sending the events. <br/><br/> When disabled, RudderStack uses `userId` (`anonymousId`, if `userId` is absent) for mapping the user with a unique identifier. In case `userId` and `anonymousId` are absent, RudderStack sends `email` or `phone` as the user's primary identifier. <br/> <br/> Note that: <ul><li>This setting is applicable only for the [`identify`](#identify) and [`track`](#track) calls.</li><li>Use this setting only if you are experiencing issues with duplicate profiles created in your Klaviyo account.</li></ul> |
|Enable to flatten user/event properties  | Turn on this setting to flatten the following data before sending it to Klaviyo: <ul><li>User properties in [`identify`](#identify) calls. </li><li>Event properties in [`track`](#track) calls. </li></ul>|

### Consent settings

Configure the below settings for cloud or web device mode based on your setup:

| Setting | Description |
| :----| :-----|
| Consent management provider| Select the relevant consent management provider from the dropdown. <br /><br />**Note**: You can add multiple consent management providers by clicking **Add group condition**. |
| Enter consent category IDs | Enter the consent category IDs you defined while setting up the consent management provider. |

## Next steps

- [Send events in cloud mode]({{< ref "destinations/streaming-destinations/klaviyo/cloud-mode/_index.md" >}})
- [Send events in device mode]({{< ref "destinations/streaming-destinations/klaviyo/device-mode.md" >}})

<br />
