Integrate with WooCommerce

Overview

This article walks your through enabling the WooCommerce integration in your Klaviyo account. The main steps are as follows:

  • Enable the WooCommerce integration
  • Install the Klaviyo Wordpress plugin
  • Install the Klaviyo WooCommerce plugin

After integrating you can optionally add product tracking and connect a WooCommerce signup from to a list in your Klaviyo account.

 

Enable the WooCommerce Integration

This process walks you through creating an API key and secret in your WooCommerce store, and then using this API key and secret to enable the WooCommerce integration in your Klaviyo account.

  1. From your Wordpress dashboard, navigate to WooCommerce > Settings > API > Keys/Apps.
  2. Click the Keys/Apps tab and click Add key. Set the Description to "Klaviyo" and set the Permissions to "Read/Write".
    wc_createAPIKey.png
  3. Click Generate API Key. Keep this tab open or note down the information, as you will need to copy/paste it in the next step.
    wc_APIkeyInfo.png
  4. Now go to your Klaviyo account, click the Integrations tab, and search for the WooCommerce Integration.
    wc_WooCommIntegration.png
  5. In you Klaviyo account, paste in the information from the WooCommerce API key you just created above. Click Connect to WooCommerce.
    wc_WooCommIntegrationSettings.png

Your data will begin to sync with Klaviyo in minutes. You've successfully enabled the WooCommerce integration.

Install the Klaviyo Wordpress plugin

The Klaviyo Wordpress plugin allows you to add a newsletter sign up form to your website, enable website activity tracking, and get data about when people start checkouts so you can send out abandoned cart emails.

You can download the base Klaviyo WordPress plugin here: https://wordpress.org/plugins/klaviyo/

To upload the plugin to your WordPress site, click the Plugins tab, then click Add New Plugin and then Upload Plugin. After uploading the plugin, install it and activate it.

wc_uploadPlugin.png

  1. After installing and activating the plugin, go to your Klaviyo account and copy your Public API Key / Site ID.
  2. Navigate to your WordPress dashboard and click on the Klaviyo menu.
    wc_KlaviyoPluginAPI.png
  3. Paste in the Public API Key / Site ID you copied above.

This completes installing the Klaviyo WordPress plugin.

Install the Klaviyo WooCommerce plugin

You can download the latest Klaviyo for WooCommerce plug in here:
http://www.klaviyo.com/media/downloads/WooCommerceKlaviyo-Latest.zip

To upload the plugin to your WordPress site, click the Plugins tab, then click Add New Plugin and then Upload Plugin. After uploading the plugin, install it and activate it.

wc_uploadPlugin.png

Test Your WooCommerce Plugins

To test out your installed plugins, go to your website and follow these instructions:

  1. Add an item to your cart.
  2. Go to the checkout page.
  3. Fill in your email address on the checkout page; when you click to another text box, Klaviyo will automatically track that you've started a checkout.
  4. Go to your Klaviyo Dashboard's Activity Feed, look for the Started Checkout metric, and you should see your checkout appear.

647824

Data Synced with the WooCommerce Integration

This section walks through some of the data you sync to your Klaviyo account from the WooCommerce integration.
647829

Checkout Started

This event is tracked when one of the following occurs:

  • A customer is logged into their account, has added something to their cart, then views the checkout page
  • A customer adds something to their cart, views the checkout page, enters a billing email address

Klaviyo will capture the Value of a cart at time of checkout, as well as other pertinent details of a customer's cart that you can leverage for personalized Abandoned Cart emails.

Placed Order

This event is tracked when a customer completes the checkout process and creates an order in your WooCommerce store. Klaviyo will record a Placed Order event when we sync an order with the status of processing or completed.

The event Klaviyo tracks includes all product information captured by WooCommerce so that you can use this detailed data in purchase follow up emails. You can filter and target Placed Order events based on the following criteria:

  • $value: The value of the order
  • ItemNames: The names of the products in someone's order, e.g., t-shirt or pants
  • IsDiscounted: Order has been discounted; true or false
  • UsedCoupon: A coupon was used on the order, e.g., true or false
  • ItemCategories: The categories to which the items in the cart belong 
  • ShippingMethods (if any)
  • Coupons (if any)

Fulfilled Order

This event is tracked when a customer completes the checkout process and creates an order in your WooCommerce store. The event Klaviyo tracks includes all of the product information about the items someone purchased including product names, images, and variable product information so you can use that information in purchase follow up emails. You can filter and target Fulfilled Order events based on the following criteria:

  • $value: The value of the order
  • ItemNames: The names of the products in someone's order, e.g., t-shirt or pants
  • IsDiscounted: Order has been discounted; true or false
  • UsedCoupon: A coupon was used on the order, e.g., true or false
  • ItemCategories: The categories to which the items in the cart belong 
  • ShippingMethods (if any)
  • Coupons (if any)

Ordered Product

This event is tracked when a customer places an order, but one event is tracked for each item someone purchases. For example, if someone buys a t-shirt and a pair of pants, one Placed Order event is tracked and two Ordered Product events -- one event for the t-shirt and one event for the pants.

The event Klaviyo tracks includes detailed information about each product someone purchases. This is useful when creating behavioral segments based on product options and other detailed information that's not available in the Placed Order event. You can filter and target Ordered Product events based on the following criteria:

  • $value: Value of the item
  • ProductId: The custom ID of a product in your WooCommerce store, e.g., 1321
  • SKU: The SKU of the product in your store, e.g., REDMEDIUMTSHIRT
  • Name: The name of a product in your store, e.g., Red T-shirt
  • Quantity: The quantity of the item ordered
  • Categories: List of categories

Customer properties

In addition to the metrics above that Klaviyo syncs from WooCommerce, there are also custom properties that are added to each Klaviyo profile. You can use these properties in segments and in flows. Here are the properties that are automatically synced from WooCommerce:

  • Email, first name, last name and location information: These built-in Klaviyo fields are automatically synced based on a customer's billing address when available

Install Klaviyo Product Tracking

If you'd like to set up a Browse Abandonment flow or build segments based on product browsing data, add the Klaviyo product tracking snippet to your product page template. This snippet captures event tracking for a "Viewed Product" metric.

Note

The location of your product page template will vary depending on your WordPress installation. We have found that most customers have succes adding this snippet to their single-product or single-post pages. The basic idea is to have this code appear on every one of your product pages.

Copy the following snippet to add to your product page template.

<?php
$ImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID ), 'single-post-thumbnail' )[0];
$ItemId = $product->id;
$Title = $product-> get_title();
$ProductUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$Price = $product->get_price();
$RegularPrice = $product->get_regular_price();
$DiscountAmount = $RegularPrice - $Price;
$terms = get_terms( 'product_tag' );
?>

<script>
var Title = "<?php echo $Title; ?>";
var ItemId = "<?php echo $ItemId; ?>";
var ImageUrl = "<?php echo $ImageUrl; ?>";
var ProductUrl = "<?php echo $ProductUrl; ?>";
var Price = "<?php echo $Price; ?>";
var DiscountAmount = "<?php echo $DiscountAmount; ?>";
var RegularPrice = "<?php echo $RegularPrice; ?>";
var _learnq = _learnq || [];

_learnq.push(['track', 'Viewed Product', {
Title: Title,
ItemId: ItemId,
ImageUrl: ImageUrl,
Url: ProductUrl,
Metadata: {
Price: Price,
DiscountAmount: DiscountAmount,
RegularPrice: RegularPrice
}
}]);
</script>

Note

The snippet above uses standard known WooCommerce variables (e.g. $Title = $product-> get_title();) These variables may be different for your theme. The important part is that product fields are dynamically rendered based on which product page you’re viewing.

After Viewed Product web tracking has been configured for your site, "Viewed Product" data should begin populating in your Klaviyo account as known visitors browse your product pages.

Sync a WooCommerce Sign Up Form to a Klaviyo List

The last thing you'll want to do is customize your newsletter subscription form so it is connected to Klaviyo. Go to Appearance > Widgets from your WordPress Dashboard. Select "Klaviyo: Email Signup" (see image below) and select the type of subscription you want (depending on your Wordpress theme). If you need help finding your Klaviyo List ID, follow these instructions

745476
 

Was this article helpful?
5 out of 6 found this helpful