×
Community Blog Performing Data Analysis on Klaviyo's Exported Data Points with Alibaba Cloud

Performing Data Analysis on Klaviyo's Exported Data Points with Alibaba Cloud

Learn how you can perform data analysis on Klaviyo's experted data points on Alibaba Cloud to built better email marketing strategies.

By Muaaz Bin Sarfaraz, data engineer and Alibaba Cloud Community Blog contributor.

Online businesses know that acquiring new customers through advertisement channels through the likes of Facebook and the Google Ad network is getting expensive over time, and lower return on advertising spending is eating up margins as the new media landscape gets increasingly saturated. So, with all of this going on, several e-commerce stores are starting to recognize the importance of retention marketing as one way to stay profitable.

No matter whether you are running a private-labelled e-commerce store or a drop-shipping store, as long as you have a subscriber email base in the thousands, you should consider utilizing your email list for passive marketing. Email marketing is known to have some of the lowest ROAS among advertising methods, as sending emails is virtually free, with the only costs that you might incur are subscription fees for the email marketing tool you use and the wages or salaries of copy writers or designers, too, of course.

In this article, we will be focusing on how you can extract Klaviyo, one of the world's most popular email marketing tool with subscriber relevant features and use Alibaba Cloud's Machine Learning Platform for AI to perform advanced data analytics for developing an efficient email marketing strategy.

By following the steps outlined in this tutorial, you will be able to achieve the following:

1. Exploratory Analysis (Basic):

You can analyze your audience to discover some insights you may have not known before and leveraging this knowledge in future email marketing campaigns. For example, you may learn the general location information of where most of your buyers live (such as the city, state, region, and country), and by learning this information you can do location-based promotions.

2. Basket Analysis (Advanced):

With this, you can learn which products are often bought together. And, with this information, you can have targeted upsell flows to promote one product to someone who has purchased the product it is often purchased with. This will increase your average order value, or AOV. Or, you can learn which products can be bundled together and promoted in email campaigns.

The Email Marketing Tool

In short, to reiterate what we covered before, email marketing tools are used for enabling businesses to perform a variety of marketing exercises, including segmentation, managing subscriber lists, opt-ins and subscriptions, A/B testing of content or subject lines, and setting up email templates, as well as a variety of other things like automating email flows, setting campaigns, and viewing deliverability reports.

Some Considerations

Also, here are some considerations for before we begin the tutorial outlined in this post:

  1. Klaviyo is used in this article but the techniques applied are relatively generic and can be applied to other ecommerce stores that use a different email marketing and automation tool like MailChimp, for example.
  2. Certain professional email marketing tools do have the capability to perform the analysis we will be doing here natively, so there wouldn't be a need to extract and transfer the data to another computing environment if you use these tools.
  3. The data set used in this tutorial is only for showing you how the process works. It's dummy data.
  4. Note that this kind of email marketing strategy can only work if your store has collected a sufficient amount of data points over a period for at least a few months.

Section 1: Extracting the List with Property Tags from Klaviyo

Step 1: Access the List and Segment Tab

1

Once you have logged into your Klaviyo account. Access the list and segments section using the Left Menu Bar. On clicking the relevant section, find the relevant list or segment on which you are interested in extracting the detail insights. Generally, it's recommended that you pick the largest list or segment you have for this purpose to extract the complete customer base for analysis.

Step 2: Manage the Lists

2

On clicking the relevant list, Klaviyo will show a list of all the email addresses that correspond to that list. Click on the button on the top right called Manage List, within the Manage List section you will see the button Export List to CSV. You'll want to click that button.

Step 3: Start the Export

3

On clicking the expert button, which we just did in the last step, Klaviyo show you a list of property tags that you can export with the selected list. It is recommended to export all the Property Tags as during your first exploratory analysis, as it will be more likely you'll find some actionable insights that you did not know before.

The following is a list of the important property tags that are minimally required for the analysis shown in the subsequent steps later in this tutorial:

  • City
  • State/Region
  • Country
  • First Active
  • Last Active
  • Historic Customer Lifetime Value
  • Predicted Customer Lifetime Value
  • Total Customer Lifetime Value
  • Last Placed Order Cart Subtotal (OCU)
  • Last Abandoned Cart Date (OCU)

Klaviyo uses its own IP address for location mapping to infer where your email audience is located and populates the "City", "State/Region" and "Country" tag columns. As it is expected that the website or Klaviyo email is accessed by an audience that is not using a VPN service, this extracted location information tends to be quite accurate. Other information is extracted based on the tracking script, such as the time when an individual customers were last active on your website. Added-To-Cart custom extensions/tracking script can enable you to get "Last Placed Order Cart SubTotal" and "Last Abandoned Cart Date" and Cart value as well.

Klaviyo also has a built-in data science and AI engine that computes certain helpful advanced analytics measures for better targeting or audience profiling. These metrics are:

  • Predicted Customer LifeTime Value
  • Predicted Number Of Orders
  • Churn Risk Prediction
  • Expected Date Of Next Order

These values can be used in a powerful manner and give a competitive edge to Email marketers. For example, Predicted Customer Lifetime Value could be used to segment and decide the level of attention and royal treatment a customer would get based on "Value Points".

Churn Risk Prediction could be used to reach out with intense personalization and try to understand why the customer is about to churn, and even give them more than average incentive to retain them.

Expected Data of Next Order could be utilized to setup a "Predicted Buy Flow" and even use an advance recommendation algorithm to pick the relevant product for that audience based on similarity index. Then pitch the recommended product in the email, on the date of next predicted purchase.

Section 2: Setting up Notebook for Advanced Analytics on Alibaba Cloud

1. Go to the Alibaba Cloud console. On the Alibaba Cloud Portal's Product tab, and select Machine Learning Platform for AI from the Analytics and Big Data section.

4

2. Next, choose DSW-Notebook Service.

5

Click the Create Instance button and if needed complete the required pre-requisites for setting up the instance. Within a few minutes your instance will be ready for use. Select the instance that is appropriate for your data size. I recommend starting with an instance of the most basic of specifications. Also, it is recommended to go with the pay-as-you-go billing method for this instance, as this is probably the most cost-effective option for you.

3. Open the instance.

6

Once the instance is ready, open it.

4. Within Data Science Workshop launcher, select Python 3.

7

5. On launching Python 3, you have access to the Jupyter Notebook interface.

8

Here we will be performing the initial exploratory analysis (note that some of this can be performed within Klaviyo) and move towards advance analytics (which is something that cannot be performed within the Klaviyo)

6. Rename the Notebook file so that you can easily find it.

7. Upload the Klaviyo exported list with property tags into Alibaba PAI.

9

8. Below is the coding involved in the Data Analysis leg of this tutorial:

--------CODE BELOW------

import pandas as pd
import seaborn as sns
import klaviyo as kl
pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000)
#Replace the Filename below with your list name that was uploaded
df = pd.read_csv(r'Klaviyo_Exported_List.csv')
df.head()

10

#Calculate percentage of missing values in each column
percent_missing = df.isnull().sum() * 100 / len(df) pd.options.display.max_rows = 4000 percent_missing

11

#Top Ten Countries in the list 
sns.countplot(y=df['Country'], order = df.Country.value_counts().iloc[:10].index)

12

#Top Ten Cities in the list
sns.countplot(y=df['City'], order = df.City.value_counts().iloc[:20].index)

13

df_buyer = df[df['Last Placed Order Cart Subtotal (OCU)']>0]
sns.countplot(y=df_buyer['City'], order = df_buyer.City.value_counts().iloc[:20].index)
#Top 20 cities where buyers live are

14

What all of this shows from the dummy data in this tutorial is that most buyers come from Hong Kong and Singapore, even though the most of the audience in the list are from Seattle. One can utilize this information for building better customer profiles. For example, based on this data you could leverage the fact you have many customers in Hong Kong and Singapore and have a Hong Kong or Singapore holiday promotion or do other Hong Kong or Singapore specific promotions, rather than just showing everyone across the board with USA based holiday promotions.

Basket Analysis (Advanced Analytics)

For this part, we will be using an Apriori algorithm to perform the basket analysis and see which products are bought together by our customer base. This can help us in creating relevant bundles and offers within our own email campaigns and flows. It is known that higher average order value (AOV), resulting in better margins.

A detail about the apriori algorithm can be read here.

from apyori import apriori
col = ['Last Placed Order Item1 Name (OCU)','Last Placed Order Item2 Name (OCU)','Last Placed Order Item3 Name (OCU)','Last Placed Order Item4 Name (OCU)','Last Placed Order Item5 Name (OCU)'] 
df_basket = df_buyer[col] df_basket.head()
df_basket['Last Placed Order Item1 Name (OCU)'] = df_basket['Last Placed Order Item1 Name (OCU)'].str.split("-", n = 1, expand = True)[0] 
df_basket['Last Placed Order Item2 Name (OCU)'] = df_basket['Last Placed Order Item2 Name (OCU)'].str.split("-", n = 1, expand = True)[0] 
df_basket['Last Placed Order Item3 Name (OCU)'] = df_basket['Last Placed Order Item3 Name (OCU)'].str.split("-", n = 1, expand = True)[0] 
df_basket['Last Placed Order Item4 Name (OCU)'] = df_basket['Last Placed Order Item4 Name (OCU)'].str.split("-", n = 1, expand = True)[0] 
df_basket['Last Placed Order Item5 Name (OCU)'] = df_basket['Last Placed Order Item5 Name (OCU)'].str.split("-", n = 1, expand = True)[0]
import numpy as np 
df_basket.head() 
df_basket = df_basket.replace('empty', np.nan)
#converting to list
records = []
for i in range (0,10562):
    records.append([str(df_basket.values[i,j]) for j in range(0,5)])
rules = apriori(records , min_support = 0.5,min_confidence =0.5,min_lift=0,min_length=2)

results = list(rules)
Output:
[RelationRecord(items=frozenset({'Product 1'}), support=0.793580761219466, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'Product 2'}), confidence=0.63580761219466, lift=1.0)]),

Definitions about support, lift and confidence can be read in the details given about the apriori algorithm above. From this output it can be seen that "Product 1" is bought by 79%, and within that Product 1 and Product 2 are bought together 63.5% of the time. Based on this, It would be a good promotion to bundle Product 1 and Product 2 together for your email campaign or for some other sort of marketing campaign or promotion.

0 0 0
Share on

Alibaba Clouder

1,779 posts | 319 followers

You may also like

Comments