Email marketing is still understood as one of the best channels to keep past customers and potential buyers in your business loop. Given this, you’ve probably already know that email marketing is one of the highest dollar ROI tasks you can do, especially in SaaS and ecommerce. Seemingly trivial details like the dates and times those emails are sent or the email design are unlikely to figure into your business decisions. But your email content doesn't matter if your customer never opens it.
Paying attention to small details, like date and time, can lead to long-term revenue gains because they're based on customer psychology. According to Forbes, email marketing is still the most powerful tool to take your business to the next level, but they also remind us that “effective email marketing strategies are personal, targeted, and crafted with the customers’ objectives and objections in mind.” Intelligent personalized email marketing uses data science, machine learning, and automation to discover these insights.
In this article, we'll explain why your retail business should use intelligent email marketing tactics, and how smart email marketing services can increase your marketing click-through and conversion rates.
The daily and weekly routines of your customers have considerable influence over how and when they want to interact with your business. If you can find insights into those routines, you can fine-tune your marketing to create convenience for your customers, make them think of your business approvingly, and increase your sales.
That’s the motivation behind email marketing optimizations, like finding the best date and time to email product information and send special offers to your customers. An intelligent email marketing software uses state-of-the-art data science and machine learning to provide insights into your customers’ routines, and create a personalized schedule for emailing them. Let’s see how your business can benefit.
In their 2019 email survey (PDF), the UK’s Data and Marketing Association reported an astounding 42x ROI from email marketing and said it’s increasing every year. By integrating our email campaign optimization technology into your email marketing system, you can see game changing changes to your email campaigns revenue. The gains come from improved click-through and conversion rates. Even in our prototype, we’ve observed a 7.5-12.5% increase in conversion rates (we'll look at those results later in this article).
The long-term gains come from the increased lifetime value of your regular customers and the intangible benefits of matching your customers’ routine and psychology, making their lives easier by sending purchase reminders at the right time.
One of the steps in our intelligent emailing technology is segmenting your customers to find regular customers with the highest customer lifetime value. You can reuse those results for other digital marketing and revenue maximization initiatives like context-aware recommendation engines, customer lifetime value prediction, and churn prediction.
By 2025, online retail sales will touch $7.4 trillion worldwide and as many as 4.6 billion email users will exchange over 376 billion emails daily. Your online retail site has to be ready to scale up.
Our production deployment uses cloud services to cater to any scale — from hundreds to millions of transactions per day. As you scale up, you could see 7-12% increased revenue month-over-month when compared with your existing revenue growth without our intelligent emailing system. That figure is just from the machine learning emailing system alone, and doesn't count all the other revenue maximization initiatives we offer.
Our email marketing optimization architecture is inspired by the approaches and models laid out in this incredible research paper. We focus on organizations selling B2C products such as consumer packaged goods, ecommerce products, and SaaS products to customers.
Based on the purchase history of your regular customers, our machine learning model first predicts the date of each customer's next purchase, i.e., the day they're most likely to purchase products from you again. Then, based on their most likely next purchase date, we derive the best dates and times to email purchase reminders, perhaps with attractive offers to improve conversion rates. The idea is that a personalized purchase reminder sent at that date and time has the best chance of converting into sales and increasing your customer's lifetime value.
Our machine learning software is implemented using the Jupyter Notebook and the Python machine learning ecosystem of libraries like scikit-learn and XGBoost. This helps our data scientists create and refine models quickly, and go straight to production. In the production deployment section later in this article, we explain how we deploy this stack.
Let’s understand the different pieces of data we need from you and your site to create an effective emailing schedule for your customers.
You push your list of customer purchase data to our customer transaction application programming interface (API) endpoint. The rate and volume of data submission depend on your business requirements. If your sales see high volatility, you'll need to push the data in real-time to constantly update our model. If you can do with a more relaxed training period, you can push it in batches once a day or so.
These are all configurable aspects. Our API supports both models using scalable architectures described in the production deployment section later in this article.
We recommend that you scrub this data of personally identifiable information before pushing it to ensure the privacy of your customers and comply with regulations like the California Consumer Privacy Act (CCPA) and the General Data Protection Regulation (GDPR). We’ve also built models to do this for you.
On our end, we too ensure privacy by storing only the data we need, dropping the data we don't (like phone numbers), scrubbing personally identifiable information, and segregating the data over multiple databases to avoid collecting detailed profiles of your customers.
You need to know your open rate — how many customers are opening your emails — and click-through rate — how many of them are clicking on the product or offer links included in your marketing emails. Most email service providers such as Mailchimp, Lemist, or Klaviyo track this information for you and allow you to export it. We also monitor that by appending a customer-specific, personalized email campaign ID as a URL parameter in each link in the email and inserting tracking pixels. When the email opens in an email client, the tracking pixel contacts a URL on your web server and gets logged in your server logs. When your customer taps or clicks a link, it reaches your site's web server and gets logged in your server logs.
Our click-through data API endpoint enables us to receive your web server logs, search them for the campaign IDs, find their opened and click-through dates and times, and create a dataset from that information for our machine learning pipeline. Note that this can become a bit confusing if you use an email forward link to chain an email thread. Many of the providers track this as well.
If your web server and logging infrastructure can retain the personalized campaign IDs throughout a customer's browsing session up until checkout, we can directly associate their purchases with the email marketing campaign. For the most part the popular email automation platforms track this for you.
But if not, we indirectly correlate them based on date and time with some configurable thresholds. For example, a purchase within 5 hours of clicking a link is attributed to the campaign as a successful conversion.
To email or message your customers, we either need their contact information to send them through our infrastructure or we will send them through your emailing infrastructure. We support both because some retailers may not be comfortable with the privacy issues of the former.
Our emailing infrastructure is described in the production deployment section later in this article. You can use our services if you don't have the infrastructure to support these campaigns. If you do have it, you just have to provide us with an API endpoint where our system tells you the date, time, contents, and customer ID to email. All popular email marketing automation platforms already store this information for you.
Other settings data include customer choices like the days and hours when they don’t want to be contacted.
In the feature engineering phase, we process the raw data to derive additional features that are likely to improve the model's ability to learn patterns. The values in the raw transaction data and click-through data are turned into the primary features for the models.
From the raw data, we derive a list of hand-crafted features (shown in the illustration above) to help the model make better predictions.
Most of these features are derived from the raw data using simple data transformations. But lifetime value segment and gender are complex and are determined using secondary machine learning models as we'll explain next. It’s not noted above but we’ve also experimented with using unsubscribe link clicks and landing page conversion statistics to boost prediction accuracy.
Lifetime values span a wide range of amounts, but grouping them under a small number of customer segments helps the prediction model. Intuitively, we can guess that these segments correlate to the income and wealth levels of customers. We use a simple k-means clustering algorithm for this.
Again, intuitively, we can guess that these segments are likely to be specific to a retailer, product category, city, or other external socio-economic factors. In production, we plan to use HDBSCAN clustering to determine the number of segments automatically. In this prototype, we evaluate the silhouette scores of the clusters to visually determine the number of clusters.
If gender is not directly available from your raw data, we derive it using a classification model. In our software, we used an internal NLP based model that allows us to predict the gender.
The machine learning pipeline has two stages and a customer classification step, all of which we'll explain next.
In this stage, we train a regression model capable of predicting each customer’s next purchase date. It's not our primary goal — ours is the best emailing date — but it's necessary to help us get there.
We can intuitively guess that the next purchase date for each customer correlates to the products and quantities they purchase. A customer who buys a carton or two of milk is likely to make their next purchase sooner than somebody who buys long-lasting house-cleaning products.
So, we recommend segmenting your customers by the product categories that appear most frequently in their purchases, then training a model for each group of related categories. You don’t need separate models for each customer — it's neither practical nor necessary. For our prototype, we selected a single product category and trained a model for the customers who purchased in that category frequently.
We chose extreme gradient boosting (XGBoost) as our machine learning model for this task. It's an ensemble learning approach that combines multiple weak learners and uses boosting to produce a strong learner. XGBoost is a feature-rich all-in-one model that helps us avoid the deficiencies of other machine learning models. Features like built-in regularized boosting help this model generalize to any kind of data by avoiding overfitting to the training data.
The input data split for training and testing is 80% and 20%. In machine learning, a strategy like cross-validation of the training data ensures that a model generalizes well against unexpected variations in the input data. That's sufficient for a simple model to predict accurately.
But XGBoost is a complex model whose ability to learn depends not just on the input data but largely on its hyperparameters. Hyperparameters are the knobs that control the behavior and execution steps of the model's algorithm. For example, the number of weak learners and the maximum tree depth are just two hyperparameters — among many more — that control how effectively it learns to predict.
So an effective training strategy for XGBoost has to plan for not just cross-validation but also for hyperparameter optimization.
XGBoost has a large number of hyperparameters that control its behavior, and each hyperparameter can take a wide range of values — often real numbers. Every combination of hyperparameter values results in a unique XGBoost model whose ability to learn and predict will be distinctly different from every other model. We end up with a combinatorial explosion of practically infinite numbers of XGBoost models.
To make this problem tractable and home in on an optimum combination of hyperparameter values that gives the best predictions, we use a grid search strategy.
The grid search works like this:
The hyperparameter combination that results in the highest R2 score is selected as the best model.
The regression model outputs the number of days to the customer's next purchase. It's the day on which the model thinks a transaction is most likely to occur. The real value it outputs is rounded to an integer — for example, 10.764 becomes 11.
With the number of days to the next purchase in hand, we apply a few personalization and business rules to give us the best emailing date and time.
The regression model's prediction is based on the general patterns it sees in the data from hundreds of customers. In this stage, we fine-tune that prediction for every customer based on their profile and history. We follow a pluggable architecture because these rules are likely to be different for every retailer and product category.
From the purchase history, we can find the distribution of purchases for each day of the week. The day with the most purchases is the day when the customer probably finds it most convenient to buy. To find a dominant day for emailing, every day of the week is given a weight based on the number of transactions on that day of the week. We select the day with the maximum score that is closest to the day predicted by the regression model.
The data processing phase generates click-through day of the week and time of the day features from web server logs. The features give us the distribution of the hour when your customers clicked the links in your marketing emails. We can also connect the personalized campaign IDs in those emails to that customer's next purchase.
There's enough data there to warrant a second regression model to accurately predict the best time of day. However, we kept it simple for this prototype by simply selecting the hour on each day of the week when the most click-throughs occurred.
Plus, we ensure that you don't disturb your customers at inconvenient hours of the day and account for each customer's do not contact preferences, regardless of what the click-through data tells us. For example, we can configure the system to delay emails scheduled after 9 PM until the next morning.
We focus on your regular repeat buyers to maximize their customer lifetime value and increase your revenue. Targeting all email subscribers with marketing emails won't yield the same level of returns on your mailing and machine learning investments. You even risk getting unsubscribe requests from irritated casual customers, receiving a negative sender reputation, getting blacklisted as a spammer by an uninterested target audience, and affecting the overall deliverability of your marketing mails
So, we need to determine a set of criteria that helps us classify your customers into regular, repeat customers or otherwise. In production where there are potentially thousands of customers, we plan to use a separate classification model for this part of the process.
But for this proof-of-concept with a limited number of customers, we reuse the same regression model to yield a set of criteria. This is a one-time task after the regression pipeline is set up, and it yields a fixed set of criteria for now.
We first segment the customer group based on the following factors:
The thresholds for these are specific to each retailer and the type of products they sell. In our pilot project, we created six customer segments based on the number of transactions in the last two months with a maximum gap of 15 to 20 days.
We train six different models, one for each of these segments. We calculate their mean absolute error (MAE) and R2 scores, and select the criteria that result in the lowest MAE and highest R2 score. Only customers who satisfy these criteria receive your marketing emails.
Factors like your customers' purchasing behavior and your merchandise mix can change over time. An accurate model created six months ago may not be accurate now. Depending on the volatility of factors, even a month may be too long.
You need a strategy to keep refining your prediction models. There are two approaches:
For our pilot project, we took the retraining approach of training a new model every month. Depending on your business needs, we can reduce this period or switch to online learning.
Your marketing emails are based on configurable email templates (with responsive HTML to look good on mobile devices) but will typically contain:
So far, we explained the data science and machine learning ideas underlying our email marketing system. These fundamental ideas are valid in a production retail environment too. But production involves more data engineering to handle the scale and velocity of data we're likely to receive when our system is deployed.
The following sections address the data engineering and integration concerns around deploying our software in production.
Our deployment architecture follows these principles:
The ingestion of your purchase transaction data works as follows:
The collection of email click-through data works like this:
If campaign IDs are retained throughout a customer's browsing session until checkout, we directly associate product purchase data with the campaign through the same web server logs you sent as part of click-through data collection. If not, we associate it during the data processing phase with time thresholds.
If you don't have emailing infrastructure, your system sends customer contact details to our customer contacts API endpoint. We also store this data in S3.
All the raw data we need is now collected in S3. When the model's first training or subsequent training is scheduled, our data preprocessing pipeline works like this:
The feature engineering works like this:
Model training and retraining occur about once a month. They work as follows:
Model inference to predict next purchase dates for customers works as follows:
The personalized fine-tuning of the best emailing date and time for these customers is run as part of the same pipeline in SageMaker. It produces an email schedule list containing customer ID, emailing date, emailing time, and email body with links to products and offers. This email scheduling data is stored in S3.
If you’re using an automated emailing tool such as Mailchimp, Klayvio, or Sendgrid we can automatically send the emails via API.
If you don't have it, our emailing workflow goes like this:
When we compare the click-through and conversion metrics from this personalized approach against the existing method of sending follow-up emails on fixed days to every customer, we see the following outcomes.
We find between a 12-17% increase in click-through rates at different time intervals — within 1 hour, 2 hours, 12 hours, and 24 hours — after the emails are received. These are statistically significant results with confidence levels over 95% in every interval.
We find between 7.5% to 12.5% increase in conversion rates at different time intervals — within 1 hour, 2 hours, 12 hours, and 24 hours — after the mailed links are clicked. Except for the 12-hour interval, these are statistically significant results with confidence levels over 95%.
We plan to explore the following improvements in the future:
Paying attention to the little hidden details in even something as simple as emailing can bring you surprising gains in sales and customer engagement. There is a best date and time to contact your customers, and if you can figure out what it is, the chances of your campaign succeeding are higher. These and many other insights are available for your SaaS, ecommerce, or retail organization, thanks to our expertise in data science and machine learning. Contact us today.