Integrate with WooCommerce

Overview

This article will walk you through integrating WooCommerce with Klaviyo. After completing the steps outlined in this guide, you'll be able to personalize and target emails based on each customer's purchases and website activity. Here's some of the data we sync from WooCommerce:

  • Sales and order data, including which products were purchased, product images, variation details and any coupons applied
  • Customer information including first and last name, location, and how they found your store
  • Started Checkout data
  • When people visit your website

In order to enable Klaviyo's WooCommerce integration, you will need to first find your Consumer Key and Consumer Secret. After enabling the WooCommerce integration, you also will need to install two plugins to ensure that all necessary data around customer and subscriber activity begin to flow into Klaviyo:

  • The Klaviyo WordPress Plugin
  • The Klaviyo WooCommerce Plugin

Locate your WooCommerce Consumer Key and Consumer Secret

You can locate your WooCommerce Consumer Key and Consumer Secret by going to WooCommerce > Settings > API > Keys/Apps in the backend of your WooCommerce store.

647819

Click Add Key and you'll see a window to create your API key. Name this "klaviyo", select your admin user, and give the key Read/Write permissions. Click Generate API Key and copy/paste the Consumer Key and Consumer Secret generated into your WooCommerce integration settings in Klaviyo.

647820

The above settings are for creating an API key in version 2.4.3 of WooCommerce and later. If you are on an earlier version of WooCommerce, you can locate your WooCommerce Consumer Key/Secret by going to Users  > Your Profile in the backend of your WooCommerce store. You will see WooCommerce API Keys at the bottom of your profile page.

Add the WooCommerce Integration

Navigate to the Integrations tab in your Klaviyo account.

Then, find the WooCommerce integration on the All Integrations list and click Add Integration.647817Once you've selected WooCommerce, you'll be brought to this screen:647818Here, you will need to provide the following required information:

  • Your WooCommerce Store URL
  • Your WooCommerce Customer Key
  • Your WooCommerce Consumer Secret

If you still need to locate this information, view the prior step in this guide. After entering in this information, click Connect to WooCommerce and your integrate will being syncing data within a few minutes!

Install the Klaviyo WordPress Plugin

There are two plugins required to ensure that your Klaviyo WooCommerce integration will run smoothly.

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

Install the base Klaviyo WordPress plugin here: https://wordpress.org/plugins/klaviyo/.

Once the site loads, click Download Version 1.3. (September 2016) This will download a zip file.

647822To upload the downloaded zip file, log into WooCommerce, click the Plugins tab on the left hand side and then click Add New Plugin and then Upload Plugin.

647823Then, locate the downloaded Klaviyo zip file and upload it. Once you've uploaded the file, be sure to activate your plugin and enter your public API key to complete the process.

745474

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 downloaded zip file, log into WooCommerce, click the Plugins tab on the left hand side and then click Add New Plugin and then Upload Plugin.

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

Review & Understand Your WooCommerce Data

The following section walks through all of the WooCommerce Metrics you will find in your Klaviyo account.
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

Verify Your Order Data

To check on your enabled WooCommerce integration, navigate to the Metrics tab in your Klaviyo account.

Click on the Placed Order metric (identifiable with a WooCommerce icon) to verify that there is data populated for this metric. If there is data, all you need to do is wait until your WooCommerce integration's historical sync has completed; this process can take up to a couple hours depending on how much data you have in your account.

Klaviyo will import all of your historic WooCommerce data. To verify this, you can compare the number of event on a particular day in Klaviyo with what's in your WooCommerce interface and confirm they match.

For example, when exploring the Placed Order metric in your Klaviyo account's Metrics tab, you can mouse over yesterday's data point or look at the table of data below the chart to see how many orders were reported yesterday. Compare that number to what's stored in WooCommercefrom yesterday and you should see they match exactly. If they don't, the issue is most likely that your Klaviyo account's timezone doesn't match your set WooCommerce timezone. To check your timezone setting in Klaviyo, go your Account Settings and navigate to Contact Information > Organization. At the bottom, you will see an area to set timezone.

Install Klaviyo Product Tracking

If you'd like to set up a Browse Abandonment flow or build segments based on product browsing data, you'll want to add JavaScript event tracking for a "Viewed Product" metric. On your product page template, add the following snippet:

<?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>

Info

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.

How Web Tracking Works

When you add Klaviyo web tracking to your site, we are only able to track the browsing activity of "known browsers" - i.e. browsers that have visited and engaged at least once before. There are two key ways we are able to identify a site visitor for web tracking purposes:

  • If someone has, at some point, clicked through a Klaviyo email to your website
  • If someone has, at some point, subscribed/opted-in through a Klaviyo form

Klaviyo will not track anonymous browsers.

Newsletter Subscriptions

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?
2 out of 2 found this helpful